problem with storing & displaying image in db

From: Date: Sat, 21 Apr 2001 12:18:48 +0000
Subject: problem with storing & displaying image in db
Groups: php.general 
Request: Send a blank email to php-general+get-50179@lists.php.net to get a copy of this message
Hello everybody, I am facing a strange problem while uploading and displaying images in a database table. I have taken blob field to store the images. Images which are less then around 100kb are stored & displayed properly but images which are greater than 100kb are giving problems while displaying although no errors were generated while inserting them in database. what could be the problem ? is it due to the blob type ? i am using the following statements to insert the file to database. insert.php *********************************** $imgsize=GetImageSize($photofile); $photo=addslashes(fread(fopen($photofile, "r"), filesize($photofile))); $query="insert into photo(photoformat,photo,photowidth,photoheight) values ('$photoformat','$photo',$imgsize[0],$imgsize[1])"; $photoformat, $photofile are the input fields of the form which is submitted. *********************************** in my html pages i use the following <img> : <img src=display.php?id=1> and my display.php is as follows: display.php *********************************** $query="select * from photo where id='$id'"; $result=mysql_query($query); $photo_rec=mysql_fetch_array($result); Header( "Content-type: image/$photo_rec[photoformat]; name=".microtime()); echo $photo_rec["photo"]; *********************************** Thanks in advance Keyur $$$$$$$

« previous php.general (#50179) next »