0
我有这样的脚本:PHP GD2略图创建脚本问题
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():提供的参数不是在/www/mdkbg.com/keasport/root/admin/parsing_vars.php5有效的图像资源上线41
可能是什么问题呢?我已将文件夹权限更改为755,并使用php5文件管道。
我没有看到错误,但这个工作。我只是有幻觉,真的没有看到区别:) – Victor 2011-02-28 13:47:06
您将新图像分配给变量'$ tmp_name',但是当您尝试使用它时,您将其称为'$ tmp_img'。 – qbert220 2011-02-28 13:49:15
aaaa现在我明白了。非常感谢你 – Victor 2011-02-28 13:51:25