how to divide image into three equal parts in php imagemagick and combine with some padding and output as single image -


i want display image 3 parts triptych of imagemagick php library. saw same example here

http://www.rubbleimages.com/canvas.php.

can me on issue please

i hopeless @ php seems work me:

#!/usr/local/bin/php -f <?php     $padding=10;    $info = getimagesize("input.jpg");    $width=$info[0];    $height=$info[1];     // calculate dimensions of output image    $canvaswidth=$width+4*$padding;    $canvasheight=$height+2*$padding;     // create white canvas    $output = imagecreatetruecolor($canvaswidth, $canvasheight);    $background = imagecolorallocate($output, 255, 255, 255);    imagefill($output, 0, 0, $background);     // read in original image    $orig = imagecreatefromjpeg("input.jpg");     // copy left third output image    imagecopy($output, $orig,$padding,             $padding,             0, 0, $width/3, $height);    // copy central third output image    imagecopy($output, $orig,2*$padding+$width/3,  $padding,      $width/3, 0, $width/3, $height);    // copy right third output image    imagecopy($output, $orig,3*$padding+2*$width/3,$padding,    2*$width/3, 0, $width/3, $height);     // save output image    imagejpeg($output,"result.jpg"); ?> 

if start this:

enter image description here

i result

enter image description here

i added black outline afterwards can see extent of image.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -