Resize() or crop() don't seem to work


#1

Hey there,

I’m trying to use the newish resize and crop methods and they don’t seem to work.

Here’s the relevant code:

<?php foreach($projects as $project): ?>
    <img src="<?= $project->images()->first()->crop(390, 256, 10)->url(); ?>" alt="<?= l::get('project-preview') ?> <?= $project->title()->html(); ?>" itemprop="image">
<?php endforeach; ?>

Here’s part of the output.

<img src="http://192.168.100.100/content/1-projects/8-reel-radio/cover.jpg" alt="Project Preview: RÉÉL-Radio" itemprop="image">

My problem right now is that the crop method did nothing. The url http://192.168.100.100/content/1-projects/8-reel-radio/cover.jpg is a full size ~1024x768 image and not a thumbnail.

Any ideas?


#2

Well this is awkward. After fighting with my thumbnails for 2 hours, I figured it out 2 minutes after posting this.

There was no /thumbs/ folder in the root of my Kirby installation. Because of that, the resize() and crop() methods wouldn’t return any thumbnails and would fail silently.

I think this could be considered as a bug or a missing feature. I’ll post an issue on GitHub shortly.


#3

I am having a similar situation as the one described in this old topic.

I do have a thumbs folder, but this code seems to not create any image there ON LOCALHOST, but it does on remote:

<image class="" xlink:href=<?=$p->image()->resize(null,226)->url() ?> height="226" >

I am on linux, thumbs folder and all its subfodlders group is www-data and they have ‘drwxrwsr-x’ permissions,

One would think the ‘s’ (setgid) bit in group execute permissions looks like the most possible culprit here, but it does not seem as if apache shouldn’t be able to write in that folder or its subfolders because of it.

In any case I tried removing setgid so I get ‘drwxrwxr-x’ on thumbs folder and subfolders, and still I don’t get any image in the thumbs folder and the original file is loading.

What can be happening?
Any way to get an error log from the resize attempt?

Thanks