/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/********************** *@filename - path to the image *@tmpname - temporary path to thumbnail *@xmax - max width *@ymax - max height */ function resize_image($filename, $tmpname, $xmax, $ymax) { if($ext == "jpg" || $ext == "jpeg") elseif($ext == "png") elseif($ext == "gif") if($x <= $xmax && $y <= $ymax) return $im; if($x >= $y) { $newx = $xmax; $newy = $newx * $y / $x; } else { $newy = $ymax; $newx = $x / $y * $newy; } return $im2; }