/** * Flips an image. * * @param string $type type of flip: horizontal / vertical / both * @return true on success. Otherwise false */ public function flip($type = 'horizontal') { try { $this->image->flip($type); return true; } catch (Exception $e) { array_push($this->errors, $e->getMessage()); return false; } }
// disable auto-orientate on load $image = new Image($orientate, false); // we can later use the autoOrientate method if we not did it previously: $image->autoOrientate()->generate(OUTPUT . 'image3-auto-orientate.jpg'); /********************************** *** EXPORTING TO OTHER FORMATS *** **********************************/ $image = new Image($image_file); $image->generate(OUTPUT . 'image4-formats.png', 'image/png'); /******************* *** FLIP IMAGES *** *******************/ $image = new Image($image_file); // vertical [or y, or v], horizontal [or x, or h] // check out Normalize::flip to see all the allowed possibilities $image->flip('vertical')->generate(OUTPUT . 'image5-flip.jpg'); /*********************** *** CROPPING IMAGES *** ***********************/ // Usefull for cropping plugins like https://github.com/tapmodo/Jcrop $image = new Image($image_file); // Values from the cropper // check out Normalize::crop to see all the allowed possibilities $image->crop(['width' => 500, 'height' => 500, 'x' => 50, 'y' => 80])->generate(OUTPUT . 'image6-crop.jpg'); /************************ *** APPLYING FILTERS *** ************************/ $image = new Image($image_file); $image->blur()->sepia()->pixelate(3, true)->vignette()->generate(OUTPUT . 'image7-effects.jpg'); /******************************** *** DIRECTLY TREATING IMAGES ***