Echoing a link to a thumbnail
Posted: Tue Nov 18, 2008 1:52 pm
So this is very weak implementation code just to really test my design in it's current state. I'm at the point where I'd like to see if and how I can get the thumbnail to act as a link to the full size image. Unfortunately, my code obviously isn't working. I know it doesn't make sense at all since the imagejpeg() function returns a boolean value and not any sort of name or html resource, but you can see where I was coming from, I'm sure. I'm just curious as to how this is carried out.
Code: Select all
<?php
require_once 'Image.php';
require_once 'SquareCropThumb.php';
$img = new Image('images/test1.jpg');
$img->makeThumb(new SquareCropThumb());
$thumb = $img->getThumb();
header('Content-Type: image/jpeg');
echo '<a href="images/test1.jpg">' . imagejpeg($thumb, NULL, 100) . '</a>';
imagedestroy($thumb);
?>