/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function shutdown() { global $orig_image, $cropped_image, $resized_image; } if(($_GET['width'] / $_GET['height']) > ($old_width / $old_height)) { $new_width = $_GET['width']; $new_height = $old_height * ($_GET['width'] / $old_width); } else { $new_width = $old_width * ($_GET['height'] / $old_height); $new_height = $_GET['height']; } imagecopyresampled($resized_image, $orig_image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height); ?> To create a thumbnail with it: <img src="path/to/thumbnailer.php?image=image.gif&width=50&height=50" alt="" />