Add support for manual & automated crops

Created on 15 March 2024, 8 months ago

Problem/Motivation

Add optional support for the Image Widget Crop β†’ and Automated Crop β†’ modules.

Proposed resolution

Add an Effect chooser on the image style generate form with the following options:

  • Default crop (A 'Scale' or 'Scale and crop' crop using the built-in effects)
  • Focal point crop (A focal point crop using the Focal Point module)
  • Manual crop (A manual crop using the Image widget crop module)
  • Manual + automated crop (A manual crop using the Image widget crop module, with fallback to an automated crop using the Automated crop module)

When Manual + automated crop is selected, an extra Automated crop provider dropdown should appear to choose the automated crop provider to use.

When Manual crop or Manual + automated crop is selected and the form is submitted, a crop type should be generated for every supported aspect ratio. These crop types are used in the generated image effects. Obsolete crop types should be cleaned up automatically.

✨ Feature request
Status

Active

Version

1.3

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

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

Merge Requests

Comments & Activities

  • Issue created by @dieterholvoet
  • Merge request !17Resolve #3428098 "Add support for" β†’ (Open) created by dieterholvoet
  • Status changed to Needs review 8 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    I think doing something like ✨ Alter hook to adjust image effect RTBC makes a bit more sense. It would reduce the complexity of this module and add more flexibility.
    Do you think a hook would also give you what you need?

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I agree ✨ Alter hook to adjust image effect RTBC would be a useful improvement, but I still think it would be a good idea to add support to the main module. With 66k+ installs Image Widget Crop is an essential part of the Crop ecosystem: together with Focal Point it’s listed on the Crop project page β†’ . Hardcoding Focal Point makes this module very opinionated. That doesn't have to be a bad thing, but if you decide to stick with only Focal Point I would document that better in the project description.

    If you’re really against adding this to the main module, we could add it as a submodule or I could even create a completely separate project, but I think that would be a bit overkill. I’d rather not keep this in custom code either since we’re talking about multiple parts: a form alter for the config form, schema for the config, an alter for the image effects. At our company we're planning to integrate this with all future and even some existing projects, so we'd like to keep any custom code to a minimum.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I fixed an issue where duplicate image effects were being added and I made the code a bit more readable.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    Now ✨ Alter hook to adjust image effect RTBC is in, we at least provide an official API to configure effects on the generated styles.

    In an ideal world, we provide an interface like the image styles entity where you can add and configure effects you would like to apply to all generated styles (same as you would apply effects to normal image styles).

    Not all effects make sense (like the ones for changing the width/height), but I guess all other effects would be nice. For example, the Image effects β†’ module also provides lots of effects sites might want to add.

    What do you think about this idea?

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Yes, I agree! That would save us from a lot of custom code. We could work on that in a separate issue?

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    That sounds good! We could also consider just rewriting this issue instead. I’m not too keen on adding specific support for other crop modules as it's currently done in the MR, so maybe we can close this and either open a new one or simply revise this issue.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I created a new issue since we're using patches from this one in a lot of projects: ✨ Add a UI for a template image style on which generated image styles will be based Active . We'll close this one as 'Won't fix' once the new one is committed.

Production build 0.71.5 2024