Created
November 16, 2015 15:39
-
-
Save bastianallgeier/23edbb66253186fa63c8 to your computer and use it in GitHub Desktop.
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
<?php | |
// resize an image by the width | |
$image->resize($width)->url(); | |
// resize by width and height. The bigger one will be downscaled | |
$image->resize($width, $height)->url(); | |
// adjust the jpeg compression | |
$image->resize($width, $height, $quality)->url(); | |
// pass null as second argument if you only want to specify the width but also change the quality | |
$image->resize($width, null, $quality)->url(); | |
// crop an image: by defining only the width the crop will be square | |
$image->crop($width)->url(); | |
// speificy a width and height to get non-square crops | |
$image->crop($width, $height)->url(); | |
// adjust the jpeg compression | |
$image->crop($width, $height, $quality)->url(); | |
// pass null again for the height if you want a square crop but also adjust the quality | |
$image->crop($width, null, $quality)->url(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both methods return a Kirby media object which has tons of additional methods. So you can also do stuff like this:
You can find more about it here: http://getkirby.com/docs/toolkit/api#media