2012-01-29 14 views
1

可能性の重複tumbnail作成:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in selectimagesx()とimagesy()エラー

が、私は自動にトップのポストのサムネイル画像を作成したいです。だから私は、これを使用してtumbnailとしてそれを使用するための小さなサイズでポストの現在の画像のサイズを変更することを決めた - resize-class.phpクラスと、このようなコードを書いた:

// Include the class 
include("resize-class.php"); 

$top_posts = mysql_query("In this query I select top posts - the most viewed posts of the day") 
while ($row = mysql_fetch_array($top_posts)){ 
    $post_id = $row['post_id']; // defining the ID of the post as variable 
    $post_image = $row['post_image']; //defining the image of the post as variable 
    //save image 
    $resizeObj = new resize($post_image); // Initialise - load image 
    $resizeObj -> resizeImage(260, 210, 'exact'); // resizing $post_image with 'exact' option 
    $resizeObj -> saveImage('images/'.$post_id.'.jpg', 80); // saving thumbnail of $post_image to the storage 
} 

をしかし、このようなループでエラーを返します。

Warning: imagesx() expects parameter 1 to be resource, boolean given in resize-class.php on line 34 

Warning: imagesy() expects parameter 1 to be resource, boolean given in resize-class.php on line 35 

Warning: imagecopyresampled() expects parameter 2 to be resource, boolean given in resize-class.php on line 77 

問題は何ですか?

+0

「サイズ変更」の関連コードを表示する必要があります:: __ construct() '、' resize :: resizeImage() 'と' resize :: saveImage() 'です。 – Bojangles

+0

私はすでにそれを私の質問でクラスと言いました。ここhttp://pastebin.com/mWHek5At – John

+0

申し訳ありませんが、リンクを表示していません。 – Bojangles

答えて

3

ではありません$post_imageは画像のパスにする必要がありますか? echo $post_imageを試してみてください...

+0

はい、私はこの問題を正しいファイルパスで解決します。ありがとう – Kamlesh

関連する問題