php - How to transform images on server using Guillotine (JS) & Intervention -


i using guillotine let user transform images. no instructions or examples provided how apply transformations on server side. using intervention, how do properly?

the image sent server following instructions:

{ scale: 1.4, angle: 270, x: 10, y: 20, w: 900, h: 675 } 

so how take info , apply photo?

here have far:

// gets true initial orientation $img->orientate();  // mirrors image user sees $img->flip('v')->flip('h');   if(isset($filedata['angle']) && $filedata['angle'] > 0 && $filedata['angle'] < 360){     $img->rotate($filedata['angle']); } 

have considered using gd library directly in php? powers intervention , simple task this, may best go straight source.

you can use php gd library resize, reshape, crop, etc. images http://php.net/manual/en/ref.image.php

this script excerpt email signature creator create landscape image , position user's profile picture on left.

// create image canvas (width, height) $canvas = imagecreatetruecolor(450, 74);  // load image $img = imagecreatefromjpeg($img_path);  // resize image , add canvas imagecopy($canvas, $img, 5, 5, 0, 0, 64, 64);  // create image imagejpeg($im); imagedestroy($im); 

Comments