I've tried several different approaches to achieve this (manipulate the alpha-channel etc) but nothing works... Now, is there ANYONE out there who knows how to do this???
This is the code:
Code: Select all
// Create image from uploaded and resize it
$uploaded = new Imagick($_FILES["file"]["tmp_name"]);
$uploaded->scaleImage(260, 208, false);
// Create reflection
$reflection = $uploaded->clone();
$reflection->flipImage();
$reflection->setImageOpacity(0.5);
// Create new image
$image = new Imagick();
$image->newImage(300, 254, new ImagickPixel("none"));
$image->setImageFormat('png');
// Add together
$image->compositeImage($reflection, Imagick::COMPOSITE_DEFAULT, 20, 208);
$image->gaussianBlurImage(3,3);
$image->compositeImage($uploaded, Imagick::COMPOSITE_DEFAULT, 20, 0);
// Save new image
$data = $image->getImageBlob();
file_put_contents ($real_dir.$_FILES["file"]["name"], $data);