0

我有这个脚本:

 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():提供的参数不是第 41 行 /www/mdkbg.com/keasport/root/admin/parsing_vars.php5 中的有效图像资源

可能是什么问题呢?我已将文件夹权限更改为 755,并使用 php5 文件提示。

4

1 回答 1

0
$tmp_name = imagecreatetruecolor( $new_width, $new_heght );

应该读:

$tmp_img = imagecreatetruecolor( $new_width, $new_heght );
于 2011-02-28T13:42:32.870 回答