I'm very new to PHP and this is the very first time I've tried to use Imagick, so there must be plenty wrong with the script I wrote in order to achieve my goal. :-)
What I'd like to do:
- Convert an image that was uploaded to JPEG and resize it;
- Make a blurred version of it;
- Move the two images to a certain directory.
I wrote a function that's supposed to do it, but, as you guessed, it doesn't do anything at all:
function convertAndBlur($inputIMG, $dst, $width, $quality) {
   $img = new Imagick($inputIMG);
   $img->scaleImage($width, 0, true); // keep aspect ratio
   $img->setImageFormat('jpeg');
   $img->setImageCompressionQuality($quality);
   $img->writeImage($dst . ".jpg");
   $imgBlur = new Imagick($img);
   $imgBlur->blurImage(5,3);
   $imgBlur->writeImage($dst . "_blur.jpg");
   $img->clear(); $img->destroy();
   $imgBlur->clear(); $imgBlur->destroy(); 
}
The function is called this way:
$picture = $_FILES["picture"]["tmp_name"];
$pictureName = "foo";
if(!is_image($picture)) { die("not an image"); }
$picturePath = "uploads/" . $pictureName;
convertAndBlur($picture, $picturePath, 1000, 90);
This will certainly make some of you roll their eyes, but again, that's completely uncharted territory to me. Could anyone help me out? Thanks!
 
    