The EasyPhpThumbnail Image Effects class allows you to handle image manipulation and PHP thumbnail generation for GIF, JPG and PNG on-the-fly. Resize, crop, rotate, flip, save as, shadow, watermark, text, border, sharpen, blur, water ripple, mirror, perspective, twirl, animation, displacement maps and more!
- Download EasyPhpThumbnail and upload the example directory to your webserver
- Upload the class (PHP4 or PHP5 version) to the 'inc' example directory
- Open the example.php page in your browser
This will display a resized thumbnail. You can edit the example.php file and try one of the many examples.
The most simple example script would be:
<?php
include_once('inc/easyphpthumbnail.class.php');
$thumb = new easyphpthumbnail;
$thumb -> Createthumb('gfx/image.jpg');
?>
This would create a thumbnail with the standard settings and send the result to the browser (dynamic or on-the-fly thumbnail generation).
If you want to integrate the thumbnail on a webpage, you have to use a dynamic image. Create a separate PHP file called for example 'thumbnail.php' and add your code there:
<?php
if (isset($_REQUEST['thumb'])) {
include_once('inc/easyphpthumbnail.class.php');
// Your full path to the images
$dir = str_replace(chr(92),chr(47),getcwd()) . '/gfx/';
// Create the thumbnail
$thumb = new easyphpthumbnail;
$thumb -> Thumbsize = 300;
$thumb -> Createthumb($dir . basename($_REQUEST['thumb']));
}
?>
Then on your page where you need the thumbnail add a link to the image like (save this sample as photo.php):
<?php
$file='image.jpg';
echo "<img src=\"thumbnail.php?thumb=$file\" alt=\"thumb\" />";
?>
Details here: EasyPhpThumbnail Class | MyWebMyMail.com