0
我需要在成功上传图片文件后制作图片的缩略图。我写了这个函数,但它似乎不起作用。希望任何人都能帮忙。由于无法使用php制作上传图片的缩略图
function make_thumb($src, $thumbDest, $thumbWidth){
$sourceImage = imagecreatefromjpeg($src);
$theWidth = imagesx($sourceImage);
$theHeight = imagesy($sourceImage);
$thumbHeight = floor($theHeight * ($thumbWidth/$theWidth));
$tempImage = imagecreatetruecolor($thumbWidth, $thumbHeight);
imagecopyresized($tempImage, $sourceImage, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $theWidth, $theHeight);
imagejpeg($tempImage, $thumbDest);
imagedestroy($tempImage);
imagedestroy($sourceImage);
}
定义“不起作用”请 – haltabush 2012-03-28 20:25:30
它不会将所创建的缩略图保存到给定的目标文件夹中,并且不显示任何内容。 – Thavarith 2012-03-28 20:46:42
您是否启用了error_reporting指令?同时检查你的错误日志。 – haltabush 2012-03-28 20:52:25