Crop not happening automatically

Created on 31 January 2025, 2 months ago

Problem/Motivation

After adding this module to a D10 setup already running Image Widget Crop/Crop API ok, I was expecting the cropping to start occurring as soon as an Automated Crop is added to the image style. As it is, nothing changes and the images are passed through untouched.

Steps to reproduce

  • Created a crop 16_9 with just an aspect ratio defined on it (16:9, unsurprisingly)
  • Added a new image style called 16:9
  • Added an Automated Crop effect to this style, selecting the crop type as 16:9 (no other effects)

Images using this style are appearing unchanged. I was expecting them all to be cropped to 16:9 with the crop centred vertically as it is by default when you look at the crops on IWC fields.

What am I missing?

πŸ’¬ Support request
Status

Active

Version

4.0

Component

Documentation

Created by

πŸ‡«πŸ‡·France paulbeaney

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @paulbeaney
  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    Ok couple of questions

    • Did you set any hard or soft limits on the crop?
    • Are you using the Automated Crop Effect or the Manual Crop effect with an automated crop provider?
    • In the widget settings, do you have "Show default crop area" checked? I have noticed that this helps to see what the automatic crop will look like. Otherwise it won't show the crop box in the Image Widget Crop until you manually set/change the default.
    • Is it just not showing in the IWC view or have you tried looking at the generated image style?
  • πŸ‡«πŸ‡·France paulbeaney

    Thanks for the quick reply!

    1. hard or soft limits on the crop?
    Yes, 620px hard limit on the width

    2. Automated Crop Effect or the Manual Crop?
    I was using the Automated Crop, but I have just tried the Manual with the default crop provider and everything has popped into place :)

    3. do you have "Show default crop area" checked?
    Yes, and now that the crops are applying, the 16:9 crop is showing as "Crop applied" on all the images.

    4. Is it just not showing in the IWC view or have you tried looking at the generated image style?
    The generated images were passing through untouched, and the IWC view was showing what I assume is the default crop (aspect ratio 16:9, full width of the image, with equal offets above and below the crop depending on the native aspect ratio of the image).

    To resume, it looks like I have should have used the Manual Crop effect then, and now I can override the crops manually if ever I want to? Should those manual changes take immediate effect? I have just tried it and they don't seem to, but that could be because we are using Amazon S3 for the file storage, which adds another layer of complication.

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    Ok so there may still be a bug with the Automated Crop style effect. But yeah the automated crop effect, likely would not show in the IWC because it skips over the ability to manually set the crop. However, the generated image should be created so I'll look into that.

    As for your question about the Manual crop changes... yes they should change right away in a normal file storage setup but I'm not sure how your S3 is set up. Does it upload/fetch files on cron? Maybe try checking there? Or try clearing cache for it to fetch something new just to test.

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    I have confirmed that the automatic crop image effect is not working and have committed a fix on the dev branch. The issue was there was a missing event type in the dispatch of the automatic crop provider list.

    $this->eventDispatcher->dispatch($event); should have been
    $this->eventDispatcher->dispatch($event, Events::AUTOMATIC_CROP_PROVIDERS);

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    Ok created release 4.0.2 that has this fixed. Closing this issue. Please feel free to reopen if you need!

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley
Production build 0.71.5 2024