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 文件提示。
I have this script:
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);
}
All data works fine. I echo every step to imagecopyresized
where I get this warning.
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /www/mdkbg.com/keasport/root/admin/parsing_vars.php5 on line 41
what could be the problem? I've changed the folder permission to 755 and I use php5 file tipes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该读:
should read: