|
Posted by Stefan Rybacki on 09/05/05 16:21
JP wrote:
> Hi Stefan,
>...
> Thing is though, this means I am doing 50 separate mysql query calls
> (one for each image) just to load one page and it just really bugs me
> because I know I can get an array containing all 50 images in a one hit
> query.
Sure, look for a possible solution below.
>... I think it's coming down to two choices :
I present a third.
>
> 1) Use the write to file method that you suggested which is almost
> certainly bullet proof for every browser and probably ok for loading speed.
>
> 2) Test which browser the user is using (at the moment I don't know how
> to do this as I am new to PHP)
> - if they are using Firefox use the super fast (echo '<img
> src="data:image/png;base64,'.$encoded.' ">';) method and
>
>...
> Any other suggestions greatly appreciated.
3) Query database once while loading the html page and store the image array into a
session and pass the sessionid and the array key to the script that displays an image
(e.g. thumb.php)
thumb.php
session_start();
$key=(int)$_REQUEST['key'];
$image=$_SESSION[$key];
header('image/png');
echo $image;
What do you thing?
Stefan
>
> Cheers,
> JP
>
>
Navigation:
[Reply to this message]
|