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(): 指定された引数は、/www/mdkbg.com/keasport/root/admin/parsing_vars.php5 行 41 の有効な画像リソースではありません

何が問題なのですか?フォルダーのアクセス許可を 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 に答える