How to get thumbs working with kirby 2.3

I’m trying to modify the project.php file in the default Kirby 2.3 template. The following works…

<?php echo $page->text()->kirbytext() ?>
      <?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
     <img src="<?php echo $image->url() ?>" alt="<?php echo $page->title()->html() ?>">
      <?php endforeach ?>

But when I try to make it output thumbs as per the line below instead it does the exact same thing … checking page source, the exact same file is being output in the html source, with no restriction of width or anything. Any thoughts?

 <img src="<?= thumb($image, array('width' => 400))->url()  ?>" alt="<?php echo $page->title()->html() ?>">

Have you verified that:

  • the thumbs folder exists
  • the thumbs folder is writable by your webserver?

PS: Please use Markdown code blocks when posting code in the future. They use three backticks at the start and end on separate lines. I have changed it for you above.

1 Like

Thanks I couldn’t figure out how to post code blocks and also I didn’t know anything about the thumbs folder…

So does it work now? :wink:

Was using on a local server and didn’t have imagemagick enabled. It works now. Maybe it’d be best to update the documents to mention both of those?