your brain supports clipboard functions?
pure genius.
also,
dynimage.php
is code to use php to resize images at the server level.
use it like this:
<img src="dynimage.php?filename=imagename.jpg&height=75&quality=50">
to resize the image called imagename.jpg to 75 pixels hight (to its correct ratio width) at 50% quality.
this code generates thumbnails and popups on this pages 'dealfinder'.
http://www.skateasylum.co.uk/acatalo...d-skates-.html
pure genius.
also,
dynimage.php
Code:
<?php
function imageScale($image, $newWidth, $newHeight)
{
if(!$size = @getimagesize($image))
die("Unable to get info on image $image");
$ratio = ($size[0] / $size[1]);
//scale by height
if($newWidth == -1)
{
$ret[1] = $newHeight;
$ret[0] = round(($newHeight * $ratio));
}
else if($newHeight == -1)
{
$ret[0] = $newWidth;
$ret[1] = round(($newWidth / $ratio));
}
else
die("Scale Error");
return $ret;
}
// The file
$filename = $_GET['filename'];
if(isset($_GET['height'])) {$newheight = $_GET['height'];} else {$newheight = 32;}
if(isset($_GET['quality'])) {$quality = $_GET['quality'];} else {$quality = 65;}
// Content type
header('Content-type: image/jpeg');
header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past
header("Expires: Mon, 26 Jul 2040 05:00:00 GMT"); // In other words... never expire the image
header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate");//Cache-Control header is
/**/
// Get new dimensions
list($width, $height) = getimagesize($filename);
$scale = imageScale($filename, -1, $newheight);
// Resample
$image_p = imagecreatetruecolor($scale[0], $scale[1]);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $scale[0], $scale[1], $width, $height);
// Output
imagejpeg($image_p, null, $quality);
?>
use it like this:
<img src="dynimage.php?filename=imagename.jpg&height=75&quality=50">
to resize the image called imagename.jpg to 75 pixels hight (to its correct ratio width) at 50% quality.
this code generates thumbnails and popups on this pages 'dealfinder'.
http://www.skateasylum.co.uk/acatalo...d-skates-.html
Comment