how to display the data of an image file

This is a discussion on how to display the data of an image file within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi all, Assuming I have stored the binary data of an image file in a blob field of a table, ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-25-2005
Kevin
 
Posts: n/a
Default 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





Reply With Quote
  #2 (permalink)  
Old 03-25-2005
Monte Watson
 
Posts: n/a
Default Re: how to display the data of an image file

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
>
>
>
>
>

Reply With Quote
  #3 (permalink)  
Old 03-25-2005
Lāʻie Techie
 
Posts: n/a
Default Re: how to display the data of an image file

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

Reply With Quote
  #4 (permalink)  
Old 03-25-2005
Kevin
 
Posts: n/a
Default Re: how to display the data of an image file

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
>



Reply With Quote
  #5 (permalink)  
Old 03-27-2005
iz0nlee
 
Posts: n/a
Default Re: how to display the data of an image file

well what was it then?
we all might have this problem at some future time
regards
"Kevin" <bird@village.org> wrote in message
news:d20d04$bjl$1@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
>>

>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:54 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0