473,503 Members | 11,783 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('application/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 2364
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('application/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('application/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_remove_get_nospam_solutions.com> дʼ
news:1111732373.9ebc38615521a8cd8e0f9fb66ebdd2a6@t eranews...
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('application/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_remove_get_nospam_solutions.com> wrote in message
news:1111732373.9ebc38615521a8cd8e0f9fb66ebdd2a6@t eranews...
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('application/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.org> wrote in message
news:d2**********@mailhub227.itcs.purdue.edu...
never mind, I have gotten the answer. thank you all.

"L?ie Techie" <laie@win_remove_get_nospam_solutions.com> дʼ
news:1111732373.9ebc38615521a8cd8e0f9fb66ebdd2a6@t eranews...
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('application/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...
4
4052
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...
1
2882
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...
2
2384
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...
5
1974
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...
5
2933
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>")...
5
5016
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...
3
5224
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...
1
2970
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...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
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...
0
7316
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...
1
6976
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...
0
7449
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...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
4993
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...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.