I am trying to resize images after upload. I have 2 files(view_project.php and user.inc.php).
In user.inc.php I am uploading images and returning an array with names of the uploaded files.
In view_project.php I am getting that array and in foreach I am trying to resize images to 20% or 60% of resolution of original image.
It absolutely doesn't work. Images are uploaded on server but not resized.
foreach($upload as $images_to_resize) {
$file = ''.showConfigValues("img_source_admin").'/'.$images_to_resize;
$src = realpath($file);
$dst = realpath($file);
$crop = false;
list($old_w,$old_h) = getimagesize($file);
if($old_w >= 1700 && $old_h >= 900) {
$w = floor(($old_w / 100) * 20);
$h = floor(($old_h / 100) * 20);
}
else {
$w = floor(($old_w / 100) * 60);
$h = floor(($old_h / 100) * 60);
}
$picture = new Imagick($src);
$picture->setImageResolution(300,300);
autoRotateImage($picture);
$picture->resizeImage(684, 457, Imagick::FILTER_LANCZOS,1, false);
$picture->writeImage($cropped);
$picture->clear();
$picture->destroy();
}
I really need your help. Thanks