PHP
3
Вклад в тег
$im = new Imagick( ROOT."/photo-cropped2.jpg" );
$im->setImageFormat("png");
$im->thumbnailImage( 200, null );
$shadow = $im->clone();
$shadow->setImageBackgroundColor( new ImagickPixel( 'black' ) );
$shadow->shadowImage( 80, 3, 5, 5 );
$shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 );
header( "Content-Type: image/png" );
echo $shadow;
define('ROOT',dirname(__FILE__));
$outFile1 = ROOT."/photo-cropped1.png";
$outFile2 = ROOT."/photo-cropped2.png";
$outFile3 = ROOT."/photo-cropped3.png";
$outFile4 = ROOT."/photo-cropped4.png";
$outFile5 = ROOT."/photo-cropped5.png";
function createImage($outFile,$w,$h,$x,$y){
$inFile = ROOT."/thumb_l_28550.png";
$image = new Imagick($inFile);
$image->cropImage($w, $h, $x, $y);
$image->writeImage($outFile);
$im = new Imagick( $outFile );
$im->setImageFormat("png");
$im->thumbnailImage( 140, null );
$shadow = $im->clone();
$shadow->setImageBackgroundColor( new ImagickPixel( 'black' ));
$shadow->shadowImage( 50, 7, 3, 3 );
$shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 );
$shadow->writeImage($outFile);
return $shadow;
}
createImage($outFile1,150, 170, 20, 190);
createImage($outFile2,150, 300, 178, 127);
createImage($outFile3,150, 600, 336, 23);
createImage($outFile4,150, 300, 495, 127);
createImage($outFile5,150, 170, 653, 190);
$src1=new Imagick(ROOT.'/white.png');
$src2=new Imagick($outFile1);
$src3=new Imagick($outFile2);
$src4=new Imagick($outFile3);
$src5=new Imagick($outFile4);
$src6=new Imagick($outFile5);
$src1->compositeImage($src2,Imagick::COMPOSITE_OVER, 20,190);
$src1->compositeImage($src3,Imagick::COMPOSITE_OVER, 178, 127);
$src1->compositeImage($src4,Imagick::COMPOSITE_OVER, 336, 23);
$src1->compositeImage($src5,Imagick::COMPOSITE_OVER, 495, 127);
$src1->compositeImage($src6,Imagick::COMPOSITE_OVER, 653, 190);
$src1->writeImage(ROOT.'/result.png');