The image styles don't need to be cleared on image insert, just update. Otherwise, this causes issues when image styles are generated programmatically.

Comments

firewaller created an issue. See original summary.

firewaller’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

Patch attached.

Eitisha’s picture

@ Patrick

The patch looks good and applied successfully .

Attached is the screenshot for applied patch.

Thanks

firewaller’s picture

Status: Needs review » Reviewed & tested by the community
berdir’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

What issues does this cause? And I don't think this is correct, adding a crop needs them to be re-created as well if they already exist?

firewaller’s picture

Flushing an image style on image insert is unnecessary since the image style does not exist yet for that image. It has been a while, but I remember this was causing issues for programmatically generated image styles and throws some sort of error or warning.

berdir’s picture

I've never had a problem with that, nor do the tests. Maybe that only happens in combination with another module or so, we'll need backtrace of those errors to continue here.

firewaller’s picture

I forget the use-case where I was experiencing the issue. Regardless, isn't it a waste of resources to clear an image style instance on an insert? I can't think of a scenario where it would be of benefit.

berdir’s picture

Only the crop configuration is new, the image and its image styles could have been created a long time ago, there is no way for us to know if image styles have been created between creating the image and creating the crop. If you do bulk import/migration of images with crop configuration where you know that it is currently the case, then you can use the existing setting to disable it temporarily.

firewaller’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Makes sense. In that case I misunderstood the functionality and we can ignore this with a custom workaround for the bulk generation. Thanks!