Here is what I'm trying to do, using Image Magick...
When a user clicks on THUMBNAIL, a page opens showing the thumbnail of the original image, generated on-the-fly.
Here is what I THINK should happen.
- If the action is thumbnail, a temporary name is created based on directory and filename, ie images/original_image.jpg.
- This temporary image is then mogrified.
- a temporary name is output to browser
- The popup window opens, putting out thumbnail_image.miff to browser window.
- tempname is closed and unlinked.
else if($action == "thumbnail")
{
$tmpfname = tempnam ("$dir", "$userfile_name");
$mogrify = system("mogrify -geometry 80% '$tmpfname'.miff");
$handle = fopen($tmpfname, "w");
mogrify;
// do here something
echo "<a href=".$tmpfname.".miff onclick=\"NewWindow(this.href,'Popup','500','300','yes');return false;\">".$file."</a>";
fclose($handle);
unlink($tmpfname);
I've never done this before. As a beginning programmer, and after thinking through it, what I THINK is wrong here is that I'm creating a temporary filename, but not creating an actual temporary image. And of course, I'm probably employing incorrect syntax.
Can someone point me in the right direction?
Have I thought through the steps correctly?
Is there any easier way to do this, perhaps?
Thanks,
Eve