I have read many of the suggestions out on the web for thumbnail generation.
As long as I am passing one file name, the function works fine.
As soon as I loop back through the code, it breaks.
I get the file name.
Put the name into a session var.
then call <img src='thumbnail.php'>,
as long as I just pass one file name. that part works.
$image1="green.jpg"
$HTTP_SESSION_VARS['sourcefile'] = $image1
<img src='thumbnail.php'>
if I try something like this it fails:
$image1="green.jpg"
$HTTP_SESSION_VARS['sourcefile'] = $image1
<img src='thumbnail.php'>
$image2="blue.jpg"
$HTTP_SESSION_VARS['sourcefile'] = $image2
<img src='thumbnail.php'>
$image1="red.jpg"
$HTTP_SESSION_VARS['sourcefile'] = $image3
<img src='thumbnail.php'>
When I try and loop back and send a second file name, the whole thing breaks down. and I get no images.
here's thumbnail.php (rough code):
<?php
session_start();
$sourcefile= $HTTP_SESSION_VARS['sourcefile'])
$picsize=getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];
$x_ratio = ($source_x/100);
if($x_ratio > 1)
{
$x = round($source_x/$x_ratio);
$y = round($source_y/$x_ratio);
}
else
{
$x = $picsize[0];
$y = $picsize[1];
}
$source_id = imageCreateFromJPEG("$sourcefile");
$target_id=imagecreatetruecolor($x, $y);
$sourcefile=imagecopyresampled($target_id,$source_id, 0, 0 , 0 , 0, $x, $y, $source_x, $source_y);
Header("Content-type: image/jpeg");
imagejpeg ($target_id, "", "50");
?>