Displaying blob(image from mysql) and text simultaneously

images php coding issues or problems here.

Moderators: macek, egami, gesf

nikhildahake
New php-forum User
New php-forum User
Posts: 1
Joined: Sun May 01, 2011 8:09 pm

Displaying blob(image from mysql) and text simultaneously

Postby nikhildahake » Sun May 01, 2011 8:25 pm

Hello,
I am having a problem displaying BLOB content (image from mysql) and text content simultaneously.




This is my code snippet(Case 1):


$db_img = mysql_result($result,0,"image");

echo $dilemma;// line of text

header("Content-type: image/gif");
echo $db_img;//image





Basically i want my webpage to out put this:


//A text line here


//An image here


however am not able to do that...because i get an error saying that header cannot be resent or something like that..

I tried output buffering but that does not work either.

ok..now i tried something like this :


Code Snippet(Case 2):

$db_img = mysql_result($result,0,"image");



header("Content-type: image/gif");
echo $db_img; //image

echo $dilemma;// line of text

Now,i want my webpage to output this:


//An image here

//and a line of text here

however am not able to do this either. In the 2nd case...the image gets displayed but the line of text does not....that is i am not able to echo anything after changing the header.

I tried changing the header to header("Content-type: text/plain");...yet am not able to echo anything after displaying the image..


please help.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Displaying blob(image from mysql) and text simultaneousl

Postby johnj » Thu May 05, 2011 3:21 am

Try this:

$tempStr = $db_img."<br/>".$dilemma;

then:
header("Content-type: image/gif");
echo $tempStr;


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest