Don’t know if it’s a bug or what else, but there are a few methods of $file object that returns null value when $file is a thumb. Code:
$thumb = $image->thumb(['crop' => true, 'width' => 1080, 'height' => 1350, 'format' => 'webp', 'quality' => 90]);
echo $thumb->mediaUrl(); //returns null
echo $thumb->contentFileDirectory(); //returns null
echo $thumb->mediaRoot(); //returns null
Is there any reason?
Thanks
Francesco
Yes, these are methods of the Kirby\Cms\File object, and a thumb is a FileVersion object, which has these methods: FileVersion | Kirby CMS
What are you trying to do?
1 Like
@texnixe you’re wonderful.
I’m using the thumb() method to scale and convert an image, but I need to save it down after the thumb is generated.
Thank you so much
Francesco
Ok, so you can get the original file (and all its properties) via $fileversion->original() | Kirby CMS
1 Like