I have two separated pieces of code that I’d like to remain separated, one uses crop() the other thumb(). But chaining these two does not seem to work, as in nothing seems to be returned from thumb().
Both crop() and thumb() supposedly returns Kirby\Cms\FileVersion
| Kirby\Cms\File
My cropping code is similar to this, and it works standalone:
<?php $portrait = $member->portrait()->toFile() ?>
<?php $minSide = min($portrait->dimensions()->width(), $portrait->dimensions()->height()); ?>
<img src="<?= $portrait->crop($minSide, $minSide, 'center')->url() ?>">
My thumbing code is similar to this and it also works standalone:
<?php $portrait = $member->portrait()->toFile() ?>
<img src="<?= $portrait->thumb(['width' => 1])->url() ?>">
But chaining both methods as below does not return any url or anything for that matter:
<?php $portrait = $member->portrait()->toFile() ?>
<?php $minSide = min($portrait->dimensions()->width(), $portrait->dimensions()->height()); ?>
<img src="<?= $portrait->crop($minSide, $minSide, 'center')->thumb(['width' => 1])->url() ?>">
I am sure the ‘why’ is simple, but I can’t wrap my head around it.
Thank you