Created
August 24, 2014 08:50
-
-
Save sashtown/bf1187b0515adfaf022e to your computer and use it in GitHub Desktop.
Thumbnails in Kirby 2
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 | |
// return thumb and set width + height | |
echo thumb($image, array('width' => 400, 'height' => 250)); | |
// return thumb and set width + height + crop | |
echo thumb($image, array('width' => 400, 'height' => 250, 'crop' => true)); | |
// return thumb and set width + height + upscale | |
echo thumb($image, array('width' => 400, 'height' => 250, 'upscale' => true)); | |
// return thumb and set width + height + quality | |
echo thumb($image, array('width' => 400, 'height' => 250, 'quality' => 70)); | |
// return thumb and set width + height + grayscale | |
echo thumb($image, array('width' => 400, 'height' => 250, 'grayscale' => true)); | |
// return thumb and set width + height + blur | |
echo thumb($image, array('width' => 400, 'height' => 250, 'blur' => true)); | |
// return url of the thumb | |
echo thumb($image, array('width' => 400, 'height' => 250))->url(); | |
// return width of the thumb | |
echo thumb($image, array('width' => 400, 'height' => 250))->width(); | |
// return height of the thumb | |
echo thumb($image, array('width' => 400, 'height' => 250))->height(); | |
// return file size of the thumb | |
echo thumb($image, array('width' => 400, 'height' => 250))->niceSize(); | |
// return url of the thumb's original file | |
echo thumb($image)->source()->url(); | |
// return width of the thumb's original file | |
echo thumb($image)->source()->width(); | |
// return height of the thumb's original file | |
echo thumb($image)->source()->height(); | |
// return file size of the thumb's original file | |
echo thumb($image)->source()->niceSize(); | |
// return extension of the thumb's original file | |
echo thumb($image)->source()->extension(); | |
?> |
@hyperperforator Hey, sorry for the late reply, didn't get any notification. AFAIK there's no native solution for that yet.
@hyperperforator You can create your own custom kirbytext tag to capture images in kirbytext and thumbnail them. I did this to generate lightbox-enabled thumbs. See thread at http://getkirby.com/forum/code-snippets/20141112/resize-images-create-thumbnails-directly-with-kirbytext-s-image-url-tag/#20141219014128
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Sascha,
Just wondering, is there a way to catch images that are being output inside a markdown block and thumbnail them?