I made a small code for resizing images present on my server. I am testing it on xampp. Here it is:
if ($img_width[0] >= 750) { $imagick_image_width = 920; }
elseif (($img_width[0] > 500) && ($img_width[0] < 750)) { $imagick_image_width = 500; }
elseif (($img_width[0] >= 200) && ($img_width[0] <= 500)) { $imagick_image_width = 500; }
$save_path = 'c:/xampp/htdocs/images/'.$image_name.'.jpg';
$image = new Imagick($save_path);
$image->resizeImage($imagick_image_width, 0,Imagick::FILTER_LANCZOS,0.95); //line 226
$image->writeImage($save_path);
$image->destroy();
I have taken img_width via getimagesize array.
When executed this gives error:
Fatal error: Uncaught exception 'ImagickException' with message 'Invalid image geometry' in C:\xampp\htdocs\test-templ.php on line 226
ImagickException: Invalid image geometry in C:\xampp\htdocs\test-templ.php on line 226
How to resolve this?