arne
1
I am in the process of updating my installation.
I have used this before to get thumbnails:
<img src="<?php echo thumb($blogItem->file(), array('width'=>'600','quality' => '70','crop' => 'true'))->url() ?>" class="showcase-image" alt="<?= $blogItem->title() ?>" />
Now I get " Error
Call to undefined function thumb()"
What do I have to change?
Thank you!
Can do it with $file->resize()
. See here and here for thumbs.
arne
3
Thank you but my PHP ist not good enough, unfortunately.
texnixe
4
This should work:
<?php if($file = $blogItem->file()): ?>
<img src="<?= $file->thumb(['width'=>'600','quality' => '70','crop' => 'true'])->url() ?>" class="showcase-image" alt="<?= $blogItem->title() ?>" />
<?php endif ?>
arne
5
I have another one of these:
<?php if($image = $project->images()->sortBy('sort', 'asc')->first()): $thumb = $image->crop(600, 600); ?>
<img src="<?php echo thumb($image,array('width'=>'600','height' => 600, 'crop' => 'true','quality' => '70'))->url() ?>" alt="Thumbnail for <?= $project->title()->html() ?>" class="showcase-image" />
<?php endif ?>
Thank you so much!
texnixe
6
It’s no different:
<?php if($image = $project->images()->sortBy('sort', 'asc')->first()): ?>
<img src="<?php echo $image->thumb(['width'=>'600','height' => 600, 'crop' => 'true','quality' => '70'])->url() ?>" alt="Thumbnail for <?= $project->title()->html() ?>" class="showcase-image" />
<?php endif ?>
When posting code blocks, please wrap code between three backticks on a separate line before and after the code block. Thanks.
arne
7
It works perfectly :-). Thank you so much for now!