День добрый. Очень хочется к выводимой картинке прикрутить Вот такую красоту или вот такую. Никак не получается. Помогите пожалуйста.
Версия системы: SLAED CMS 6.* Pro
Версия PHP: 5
Сервер: Сервер в интернете
Это верно.Без знаний PHP не обойтись.
// Input image $image = $input10; // Resize to a png to stop quality loss exec("convert $image -thumbnail 500x500 temp.png"); // Get the size of the original image $size = getimagesize('temp.png'); // The canvas frame edge $edge = $size[0]*.06; // New central portion width $width = $size[0] - ( $edge * 2 ); // New central portion height $height = $size[1] - ( $edge * 2 ); // Reduction of edge width $shrink = round(( $edge * 0.6 ), 2); // Angle of the edge $angle = 30; // Change in edge height // Convert angle to radian > angle in degrees * Pi / 180 $radian = ( $angle * Pi() ) / 180; $alpha = round((abs(tan($radian)) * $shrink), 2); // Edge short side $short_side = round( ($height - $alpha ), 2); // Top long side $top_long = round($width + $shrink, 2); // Crop for the edges $cmd = " temp.png ( -clone 0 -crop {$width}x{$height}+{$edge}+{$edge} -write center.miff +delete )". " ( -clone 0 -crop {$width}x{$edge}+$edge+0 -write top.miff +delete )". " -gravity northeast -crop {$edge}x{$height}+0+{$edge} -write right.miff +delete null: "; exec("convert $cmd "); // Perspective for the RHS $cmd = " right.miff -virtual-pixel background -background none ". " +distort Perspective \"0,0 0,0 $edge,0 $shrink,-$alpha $edge,$height $shrink,$short_side 0,$height 0,$height\" +repage -trim"; exec("convert $cmd right_edge.miff"); // Perspective for the top $cmd = " top.miff -virtual-pixel background -background none ". " +distort Perspective \"0,0 $shrink,0 $width,0 $top_long,0 $width,$edge $width,$alpha 0,$edge 0,$alpha\" +repage -trim"; exec("convert $cmd top_edge.miff"); // There was a 1px gap between the RHS and main photo $tweek = $width-1; // Join the images $cmd = " ( -page -1,0 top_edge.miff -page +0+$alpha center.miff -page +$tweek+0 right_edge.miff -background none -layers merge ) ". " ( +clone -background black -shadow 95x10+15+15 ) +swap -background none -layers merge +repage "; exec(" convert $cmd canvas1.png"); // Display the final image echo ""; // Alternative style $cmd = " canvas1.png -virtual-pixel background -background none ". " +distort Perspective \"0,0 0,-40 962,0 962,0 962,602 962,602 0,602 0,562\" +repage -trim"; exec("convert $cmd canvas2.png"); // Display the final image echo ""; // Cleanup foreach ( glob("*.miff") as $filename ) { unlink($filename); }
<?php?>
$im = new Imagick('Desert.jpg'); $im->setImageFormat('png'); $d = $im->getImageGeometry(); $w = $d['width']; $h = $d['height']; $im3 = new Imagick(); $im3->newImage(1, $h, 'none','png'); $im3->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $im1 = $im->clone();; $im1->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $im1->setImageMatte(true); $im1->cropImage(($w-10), $h, 0, 0); $controlPoints = array( 0,0, 15,15, ($w-10),0, ($w-10),0, 0,$h, 25,($h-20), ($w-10),$h, ($w-10),$h ); $im1->distortImage(Imagick::DISTORTION_BILINEAR, $controlPoints, true); $im2 = $im->clone(); $im2->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $im2->setImageMatte(true); $im2->cropImage(10, $h, ($w-10), 0); $controlPoints2 = array( 0,0, 0,0, 10,0,10,10, 0,$h, 0,$h, 10,$h, 10,($h-10) ); $im2->distortImage(Imagick::DISTORTION_BILINEAR, $controlPoints2, true); $image = new Imagick(); $image->addImage($im1); $image->addImage($im3); $image->addImage($im2); $image->resetIterator(); $combined = $image->appendImages(false); $shadow = $combined->clone(); $shadow->setImageBackgroundColor( new ImagickPixel( 'black' ) ); $shadow->shadowImage( 50, 3, 5, 5 ); $shadow->compositeImage( $combined, Imagick::COMPOSITE_OVER, 0, 0 ); $shadow->writeImage('Desert_Distorded.png');
Форум
Контакты