Drupal 7 is about to have a patch committed which adds 'dimensions callback' and 'dimensions passthrough' attributes to image styles. Styles that alter an images dimensions should use the dimensions callback to notify image.module or any changes to the dimensions, and styles that do not alter the image dimensions should set dimensions passthrough. This allows Drupal to keep track of the dimensions of the styled image in a way that does not affect performance.

See #1129642: Populate HTML image tags with dimension attributes (like D6 imagefield) without re-introducing I/O

Imagecache_actions needs to be updated to make use of these new callbacks.

Comments

mrfelton’s picture

Status: Active » Needs work
StatusFileSize
new8.06 KB

The attached patch does so for canvasactions. It's probably not the best implementation as it was knocked out very quickly, but it does seem to work.

cyberwolf’s picture

I can confirm that the patch works for the "Overlay (watermark)" action.

semiaddict’s picture

I can also confirm that the patch works for the "Scale" and "Define canvas" actions.

fietserwin’s picture

Status: Needs work » Fixed

Your patch did not apply anymore, but the changes were easy to follow. As your patch was not handling all effects, I added callback functions for all other effects that might change the dimensions as well. As they currently have a standard implementation that sets width and height to NULL (unknown) I have not yet uploaded the change.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.