473,569 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to display the data of an image file

Hi all,

Assuming I have stored the binary data of an image file in a blob field
of a table, how can I display it as an image in a web page? I found some
instructions on the web, such as

header('applica tion/octet-stream');
echo $imgdata;

I don't know why I always get this warning.

----------------
Warning: Cannot modify header information
-------------

How can I get rid of it and show the image as an element of the current web
page?

Thanks, kevin

Jul 17 '05 #1
5 2372
On Fri, 25 Mar 2005 01:00:55 -0500, Kevin wrote:
Hi all,

Assuming I have stored the binary data of an image file in a blob field of
a table, how can I display it as an image in a web page? I found some
instructions on the web, such as

header('applica tion/octet-stream');
echo $imgdata;
First mistake - send the proper Content-type header! If it's a JPEG, tell
the browser it's a JPEG.

I don't know why I always get this warning.

----------------
Warning: Cannot modify header information -------------

How can I get rid of it and show the image as an element of the current
web page?


That means some content was already sent. Check for any whitespace before
your PHP code.

HTH,
La'ie Techie

Jul 17 '05 #2
You can't have any html output before you issue the header command -
even blank lines in any html blocks of code that might be on your page
would be enough to give you that error. (I got this error alot when
first learning php)

I haven't worked with image binary data stored in a blob field, I've
only used gd command libraries to create inline images. Maybe someone
else can address that part of your question.

Monte

Kevin wrote:
Hi all,

Assuming I have stored the binary data of an image file in a blob field
of a table, how can I display it as an image in a web page? I found some
instructions on the web, such as

header('applica tion/octet-stream');
echo $imgdata;

I don't know why I always get this warning.

----------------
Warning: Cannot modify header information
-------------

How can I get rid of it and show the image as an element of the current web
page?

Thanks, kevin


Jul 17 '05 #3
never mind, I have gotten the answer. thank you all.

"L?ie Techie" <laie@win_remov e_get_nospam_so lutions.com> дʼ
news:1111732373 .9ebc38615521a8 cd8e0f9fb66ebdd 2a6@teranews...
On Fri, 25 Mar 2005 01:00:55 -0500, Kevin wrote:
Hi all,

Assuming I have stored the binary data of an image file in a blob field of a table, how can I display it as an image in a web page? I found some
instructions on the web, such as

header('applica tion/octet-stream');
echo $imgdata;


First mistake - send the proper Content-type header! If it's a JPEG, tell
the browser it's a JPEG.

I don't know why I always get this warning.

----------------
Warning: Cannot modify header information -------------

How can I get rid of it and show the image as an element of the current
web page?


That means some content was already sent. Check for any whitespace before
your PHP code.

HTH,
La'ie Techie

Jul 17 '05 #4

"La?ie Techie" <laie@win_remov e_get_nospam_so lutions.com> wrote in message
news:1111732373 .9ebc38615521a8 cd8e0f9fb66ebdd 2a6@teranews...
On Fri, 25 Mar 2005 01:00:55 -0500, Kevin wrote:
Hi all,

Assuming I have stored the binary data of an image file in a blob field of a table, how can I display it as an image in a web page? I found some
instructions on the web, such as

header('applica tion/octet-stream');
echo $imgdata;


First mistake - send the proper Content-type header! If it's a JPEG, tell
the browser it's a JPEG.


Not much of a mistake, really, since modern browsers determine the image
type from the data stream--not the mime header. Otherwise they wouldn't be
able to load a HTML page sitting on a disk.

You can actually use that fact to discourage people from saving images from
your site. Just change the extension of all your image files to .tar.gz or
something. When they're referenced in a img tag, the browser will spiff out
the image type and display them correctly. When a user right click to save
the file, it'll end up as a .tar.gz file and won't open.

Jul 17 '05 #5
well what was it then?
we all might have this problem at some future time
regards
"Kevin" <bi**@village.o rg> wrote in message
news:d2******** **@mailhub227.i tcs.purdue.edu. ..
never mind, I have gotten the answer. thank you all.

"L?ie Techie" <laie@win_remov e_get_nospam_so lutions.com> дʼ
news:1111732373 .9ebc38615521a8 cd8e0f9fb66ebdd 2a6@teranews...
On Fri, 25 Mar 2005 01:00:55 -0500, Kevin wrote:
> Hi all,
>
> Assuming I have stored the binary data of an image file in a blob field of > a table, how can I display it as an image in a web page? I found some
> instructions on the web, such as
>
> header('applica tion/octet-stream');
> echo $imgdata;


First mistake - send the proper Content-type header! If it's a JPEG,
tell
the browser it's a JPEG.
>
> I don't know why I always get this warning.
>
> ----------------
> Warning: Cannot modify header information -------------
>
> How can I get rid of it and show the image as an element of the current
> web page?


That means some content was already sent. Check for any whitespace
before
your PHP code.

HTH,
La'ie Techie


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1966
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual Basic .Net application. I have researched MSDN for help and found the example article 321900 (see below) and set up a test and everything works fine...
4
4057
by: Dean L. Howen | last post by:
I create my own file format that could content many image files (jpg, ico, ....) . I can get the data of each image, and I want to display it on the form. How can? I've tried to create a file with the image data I want to show and open it with that file name. No problem about this way. But I don't think it a good way Could anybody help me...
1
2886
by: Eric Keung | last post by:
Hi all, my case is I want to get an image from access database and I just know it's "OLE object" field type at access I also don't know how to insert it into access here is my code and it just can display a invalid image try dim strConn as string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath
2
2395
by: Wayne Wengert | last post by:
I am trying to build an ASP.NET application which includes the capability to allow users to save pictures to a SQL Server 2000 database table and then later to display selected photos (usually JPG files). I found some sample code via a google search which showed how to upload a jpg file using ASP (HtmlInputFile) and save it in an Access...
5
1979
by: Martin Moser | last post by:
Does somebody knows, if theres a way to display any file (tiff, doc, pdf, .....) "inline" on an asp.net site? What I want to do is, to display a file, which is stored in the DB, and some information around it. If you know a way, or a third party control, please let me know. tia Martin
5
2940
by: david | last post by:
Can I use WriteFile methods? It seems that it does not work. For example, the following code only dispay one figure. Response.WriteFile("images/image002.jpg") Response.Write("<br><p>") Response.WriteFile("images/image003.jpg") Response.Write("<br><p>") Any help? Thanks
5
5022
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page that calls the web service to render a vertical strip of images. After doing some research I am unable to find some vb.net code that can assist...
3
5229
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add...
1
2979
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for image upload in database: -----------Upload.jsp---------------- <html> <head> <title>Account Details </title>
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.