Re: Unable to display images on browser

From: Date: Wed, 27 Feb 2002 09:23:31 +0000
Subject: Re: Unable to display images on browser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86387@lists.php.net to get a copy of this message
try using gd if you have >= 1.8.3 then you will have to use ImagePng() and Content-type: image/png instead of ImageGif() to export the image. header ("Content-type: image/gif"); $im = ImageCreateFromString ($fileContent); ImageGif ($im); =S. On Tue, 26 Feb 2002, Narvaez, Teresa wrote: > Hello, > I do not understand why I can't display images retrieved from MySQL > on my browser(IE 4.0). When I retrieve the image from MYSQL I set the > Header function to change the type of content(image/gif) I am sending to the > browser. However, the browser displays an box with an X in it. I would > greatly appretiate any ideas/help. Here is the piece of code: Thanks in > advance! -Teresa > > <? > ------------ Code to connect and selected DB not included > --------------------- > $dbQuery = "Select PicNum, size, type, description, Image"; > $dbQuery .= " FROM Images WHERE PicNum = $fileId"; > > $result = mysql_query($dbQuery) > or die ("Could not get file list: " . mysql_error() ); > echo "Sent Query successfully<br>"; > > if ( mysql_num_rows($result) == 1) > { > $fileType = @mysql_result($result,0, "type"); > $fileContent = @mysql_result($result, 0, "Image"); > $filedesc = @mysql_result($result,0, "description"); > $filenum = @mysql_result($result,0, "PicNum"); > // Header("Content-type: $fileType"); > Header("Content-type: image/gif"); > echo $fileContent; > } > else > { > echo "Record does not exist"; > } // else > ?> >

« previous php.general (#86387) next »