[英]php gd2 thumbnail creator script problem
我有这个脚本:
function createThumb($source, $thumb_width=100)
{
$fl = dirname($source).'<br>';
$new_name = 'thumb_'.basename($source);
$img = imagecreatefromjpeg($source);
$width = imagesx($img);
$height = imagesy($img);
$new_width = $thumb_width;
$new_heght = floor($height * ($thumb_width / $width));
$tmp_name = imagecreatetruecolor( $new_width, $new_heght );
imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_heght, $width, $height);
imagejpeg($tmp_img, $fl.DIRECTORY_SEPARATOR.$new_name);
}
所有数据工作正常。 我将每一步都imagecopyresized
给imagecopyresized
,并在其中收到此警告。
警告:imagecopyresized():提供的参数不是在/www/mdkbg.com/keasport/root/admin/parsing_vars.php5有效的图片资源上线41
可能是什么问题呢? 我已将文件夹权限更改为755,并且使用php5文件提示。
$tmp_name = imagecreatetruecolor( $new_width, $new_heght );
应该读:
$tmp_img = imagecreatetruecolor( $new_width, $new_heght );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.