Ok you may call me crazy but i'm doing this for the future storage.
I just made a picture repository for all my pictures. I have stored like this
one table for the original picture (average picture size is 1.5megs)
one table for the web pictures (average picture size is 20k)
one table that has all the info about the picture and uses a key to access the other two picture tables.
(each table has about 100 records)
Now, my problem is the slow query time for the big original picture. now the query time is very fast if i do it via command prompt or even by MySQL control Center but when i want to display the original picture on the web with PHP it's very slow. This is before it starts download. After tracing though the code it's very slow at the mysql_query function. I don't understand why it would be very slow there when it's very fast at the command prompt and even at the Mysql control center. Unless it's slowing in moving the data over to php.
Any way I could optimize this? My code looks like this
$query = "select picture,filetype,filename from original_pic where id=".$_GET["id"];
$result = mysql_query($query);
$data = MYSQL_RESULT($result,0,"picture");
$type = MYSQL_RESULT($result,0,"filetype");
$name = MYSQL_RESULT($result,0,"filename");
Header("Content-disposition: attachment; filename=$name");
Header("Content-type: $type");
echo $data;