Problems with cropImage()
Posted: 2011-09-26T13:03:54-07:00
I've been a programmer for a long time, but am just now getting into PHP. I have an application where I need to re-size and crop an image, below is a snippet of code. The re-size works, but the crop does not, yet I still get "Crop Succeeded!" as a result. Ideas? Thanks in advance!
Code: Select all
if($w > $h){ //Image is landscape
$orientation = 'landscape';
if($w > 600){
$picture->resizeImage($w*(600/$h) , 600 , Imagick::STYLE_NORMAL , 0); //Set height to 600, scale width proportionally (so that when the crop is done, the final result is 600x600)
}
if($picture->cropImage($height, $height,($width / 2) - ($height / 2), 0)){
echo "Crop Succeeded!";
}
else{
echo "Crop Failed :(";
}
}