Created
July 26, 2018 15:53
-
-
Save lasekmiroslaw/a89675efff452ae74af486f1a7e2cc77 to your computer and use it in GitHub Desktop.
php working with files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGES : | |
<?php<?php | |
trytry { { | |
//// Create a new SimpleImage object Create | |
$image = new \claviska\SimpleImage(); | |
// Magic! ✨ | |
$image | |
->fromFile('image.jpg') // load image.jpg | |
->autoOrient() // adjust orientation based on exif data | |
->resize(320, 200) // resize to 320x200 pixels | |
->flip('x') // flip horizontally | |
->colorize('DarkBlue') // tint dark blue | |
->border('black', 10) // add a 10 pixel black border | |
->overlay('watermark.png', 'bottom right') // add a watermark image | |
->toFile('new-image.png', 'image/png') // convert to PNG and save a copy to new-image.png | |
->toScreen(); // output to the screen | |
// And much more! 💪 | |
} catch(Exception $err) { | |
// Handle errors | |
echo $err->getMessage(); | |
} | |
https://github.com/claviska/SimpleImage | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment