Problems while viewing images from the database

From: Date: Tue, 30 May 2000 19:16:51 +0000
Subject: Problems while viewing images from the database
Groups: php.general 
Request: Send a blank email to php-general+get-659@lists.php.net to get a copy of this message
I have stored images in mysql and I am trying to view them using a different file. I have a file called get.php <?php if ($id) { @mysql_connect("localhost","nobody",""); @mysql_select_db("scd"); $query = "select bin_data,filetype from images where id='$id'"; $result = @mysql_query($query); $data = @mysql_result($result,0,"bin_data"); $type = @mysql_result($result,0,"filetype"); Header("Content=type:$type"); echo $data; }; ?> I have another file test.html where I have a single line <img src="get.php?id=1"> Now when I have it like that and I point to test.html everything works. However,I seem to be able to make only gifs/jpegs work. tiffs are showing the broken icon with this somehow. If I did http://..../get.php?id=1 I will get garbage onto my screen for any format of file and when i do save as and save the file I can view the file. What am I doing wrong here ? Thank You Sunil

« previous php.general (#659) next »