PDA

View Full Version : 'On the Fly' Auto Thumbnailer using GD Library



michael_s
03-12-2007, 08:12 PM
Based on nate_02631's 15 Dec 2005

Much like new tep_image() function in catalog/includes/functions/html_output.php
Just replace tep_image() function in catalog/admin/includes/functions/html_output.php with

function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

// Set default image variable and code
$image = 'r / $height = $image_size[1];br / }br / br / // Scale the image if larger than the set width or heightbr / if ($image_size[0] > $width || $image_size[1] > $height) {
$rx = $image_size[0] / $width;
$ry = $image_size[1] / $height;

if ($rx < $ry) {
$width = intval($height / $ratio);
} else {
$height = intval($width * $ratio);
}

$image = 'http://www.oscmax.com/forums/../product_thumb.php?img=' . ($src[0] == '/' ? substr($src, 1) : $src) . '&w=' . tep_output_string($width) . '&h=' . tep_output_string($height) . '';

return $image;
}

More... (http://www.oscommerce.com/community/contributions,2226)