After updating from 7.x-1.0 to 7.x-1.1, the "aspect switcher" action no longer works. I'm getting the landscape style regardless of the aspect ratio of the original.

Reverting back to 7.x-1.0 restores the expected functionality.

Comments

fietserwin’s picture

Hmmm, it seems to work fine for me. Can you export the styles involved (using the Image styles admin sub module) and paste the strings here?

John Pitcairn’s picture

The plot thickens. What I'm getting is the portrait style, but with incorrect width and height attributes specified in the image tag, as if it were the landscape style. If I manually change the attributes to reflect the natural size of the image in the relevant portrait style directory it looks correct. Styles:

a:4:{s:4:"name";s:35:"gallery-main-aspect-switcher-normal";s:7:"effects";a:1:{i:13;a:10:{s:5:"label";s:15:"Aspect switcher";s:4:"help";s:173:"Use different effects depending on whether the image is landscape of portrait shaped. This re-uses other preset definitions, and just chooses between them based on the rule.";s:15:"effect callback";s:26:"canvasactions_aspect_image";s:19:"dimensions callback";s:31:"canvasactions_aspect_dimensions";s:13:"form callback";s:25:"canvasactions_aspect_form";s:13:"summary theme";s:28:"canvasactions_aspect_summary";s:6:"module";s:24:"imagecache_canvasactions";s:4:"name";s:20:"canvasactions_aspect";s:4:"data";a:3:{s:8:"portrait";s:28:"gallery-main-portrait-normal";s:9:"landscape";s:29:"gallery-main-landscape-normal";s:16:"ratio_adjustment";s:4:"1.15";}s:6:"weight";s:1:"1";}}s:6:"module";s:19:"offlimits_galleries";s:7:"storage";i:4;}
a:4:{s:4:"name";s:29:"gallery-main-landscape-normal";s:7:"effects";a:1:{i:14;a:10:{s:5:"label";s:5:"Scale";s:4:"help";s:142:"Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.";s:15:"effect callback";s:18:"image_scale_effect";s:19:"dimensions callback";s:22:"image_scale_dimensions";s:13:"form callback";s:16:"image_scale_form";s:13:"summary theme";s:19:"image_scale_summary";s:6:"module";s:5:"image";s:4:"name";s:11:"image_scale";s:4:"data";a:3:{s:5:"width";s:3:"576";s:6:"height";s:0:"";s:7:"upscale";i:0;}s:6:"weight";s:1:"1";}}s:6:"module";s:19:"offlimits_galleries";s:7:"storage";i:4;}
a:4:{s:4:"name";s:28:"gallery-main-portrait-normal";s:7:"effects";a:1:{i:21;a:10:{s:5:"label";s:5:"Scale";s:4:"help";s:142:"Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.";s:15:"effect callback";s:18:"image_scale_effect";s:19:"dimensions callback";s:22:"image_scale_dimensions";s:13:"form callback";s:16:"image_scale_form";s:13:"summary theme";s:19:"image_scale_summary";s:6:"module";s:5:"image";s:4:"name";s:11:"image_scale";s:4:"data";a:3:{s:5:"width";s:0:"";s:6:"height";s:3:"500";s:7:"upscale";i:0;}s:6:"weight";s:1:"2";}}s:6:"module";s:19:"offlimits_galleries";s:7:"storage";i:4;}

These three styles are provided by a custom module, using hook_image_default_styles().

fietserwin’s picture

Status: Active » Fixed

I've updated the code that calculates the aspect switcher dimensions (see #1591198: Incorrect width and height attributes on img tags (due to dimensions calculations ignoring NULL's)). I tested it locally and can see that the dimensions are now correctly passed from the correct sub-style. (And also quite easy: #464092: Aspect Switcher / Subroutine: Need to Flush image style on changes in called style works nicely as well...)

Can you check on your site and reopen if it still fails at your site?

Status: Fixed » Closed (fixed)

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