Skip to content

Instantly share code, notes, and snippets.

@lasekmiroslaw
Created July 26, 2018 15:53
Show Gist options
  • Save lasekmiroslaw/a89675efff452ae74af486f1a7e2cc77 to your computer and use it in GitHub Desktop.
Save lasekmiroslaw/a89675efff452ae74af486f1a7e2cc77 to your computer and use it in GitHub Desktop.
php working with files
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