killmunch
12-03-2003, 08:24 PM
i just need to know how to use this script i need a simple thumbnail script. dont really get php, so if you could explain this a little bit very greatful i would be
<?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("/img/x.jpg",100,"/img/thm/","xt.jpg");
?>
<?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("/img/x.jpg",100,"/img/thm/","xt.jpg");
?>