hello all.. I am trying to make a function to resize images but i'm getting an error.

Error:

Warning: imagecopyresized(): Invalid image dimensions

here's the code:

function imageResize($image) {

$dimensions = getimagesize($image);
$width = $dimension[0];
$height = $dimension[1];
$newWidth = 200;
$newHeight = 150;
$canvas = imagecreatetruecolor($newWidth,$newHeight);
$piece = imagecreatefromjpeg($image);
imagecopyresized($canvas, $piece, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
imagejpeg($canvas, $image, 90);
}

I don't understand what the problem is really :queasy:

Hope someone can help me out.

    hahaha.. as soon as I submitted I found the problem.

      10 days later

      i think it's good idea to post what you found so ppl can learn from it 🙂
      thanks

        nagasea wrote:

        i think it's good idea to post what you found so ppl can learn from it 🙂
        thanks

        Typing error... defined dimensions then used dimension

          Write a Reply...