[PHP] problem with storing displaying image in db

2001-04-24 Thread Keyur Kalaria

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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problem with storing displaying image in db

2001-04-24 Thread Keyur Kalaria

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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] problem with storing displaying image in db

2001-04-22 Thread Steve Lawson

Why not just store the filename?

SL.

- Original Message -
From: "Keyur Kalaria" [EMAIL PROTECTED]
To: "php" [EMAIL PROTECTED]
Sent: Saturday, April 21, 2001 9:52 AM
Subject: [PHP] problem with storing  displaying image in db


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





 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]