steirico / kirby-plugin-image-crop-field

Kirby image crop field based on vue-cropperjs and gumlet/php-image-resize
MIT License
15 stars 3 forks source link

Cropped images appear twice when getting images by $page->images(). #8

Open steirico opened 5 years ago

theopaolo commented 4 years ago

Hi Steirico,

Have you found a solution or maybe a workaround for this issue ?

And thanks for the work put in the plugin, it's exactly what I need for a project I'm working on.

Cheers

DodoVoelkel commented 4 years ago

This feels very wrong but it works for me:

I just remove the objects with the name "cropped" out of the collection. It will render the cropped images anyhow.

   $items = $page->images();
   foreach ($items->search('cropped') as $cropped) {
       $items->remove($cropped);
   };
   foreach($items as $image) {
   [...]
mrflix commented 1 year ago

You can also run $page->images()->filterBy('filename', '!*=', '-cropped-') to filter out the cropped images.