Download & Extend

Aspect switcher doesn't respect crop offset keywords from subactions

Project:ImageCache Actions
Version:6.x-1.6
Component:Canvas Actions Module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

While working with the very usefull aspect switcher action I noticed it doesn't respect the x offset and y offset settings from the subaction crop method.
When I use an offset with pixels it works like a charm, but with using the offset keywords it always uses top left.

The example image in the subactions shows the correct manipulation. The example image from the action with the aspect switcher uses top left.

I'm using the following module versions:
- Imagecache 6.x-2.0-beta10
- ImageApi 6.x-1.6
- Image toolkit GD2

Comments

#1

Title:Aspect switcher doesn't respect crop actions from subactions» Aspect switcher doesn't respect crop offset keywords from subactions

Just a clearer title.

#2

Status:active» postponed (maintainer needs more info)

I can't imagine how being called from an aspect switcher would be affecting the behaviour of the sub-actions. They should be entirely modular.
It may be possible for the size of the image to become incorrect sometimes (under imagemagick) and that may produce what looks like an incorrect result, but really, the fact that a sub-preset is being called from an aspect-switching context should NOT make any difference to the way the keywords are parsed!
Are you sure the sub-actions are working correctly outside of the switcher?

Can you post a few screenshots of the settings pages?

#3

That was what I was thinking. The sub-actions work great outside the switcher.
But I got a workaround right now. I'm only using the scale action in the sub-action and then crop in the aspect-switcher.
This works like expected and does the job for me!

I attached an image that shows the problem when I'm using a crop in the sub-action.

AttachmentSize
imagecache-aspectswitcher-test.jpg 297.41 KB

#4

I'm experiencing the exact same problem. It's odd that the sub-actions work fine on their own but then get messed up when used in the aspect switcher. It seems the alignment of the cropped image is always set to top left despite what it's supposed to be in the ImageCache action.

I can post screenshots if need be, but the problem is identical as that described above.

#5

Hi,

I think I just ran into the same problem - sub-actions work fine but the switcher doesn't. One of my sub-action also has a crop.

preset 340x340hor
Scale And Crop 340x340
http://ball.in.th/sites/default/files/imagecache/340x340hor/imagecache_s...

preset 340x340ver
Crop width: 100%, height: 80%, xoffset: center, yoffset: top
Scale And Crop 340x340
http://ball.in.th/sites/default/files/imagecache/340x340ver/imagecache_s...

preset 340x340
Aspect switcher: Portrait size: 340x340ver. Landscape size: 340x340hor
http://ball.in.th/sites/default/files/imagecache/340x340/imagecache_samp...
In this case, the result should be the same as http://ball.in.th/sites/default/files/imagecache/340x340ver/imagecache_s... , but it's not.

#6

Status:postponed (maintainer needs more info)» active

#7

I have just installed this module (6.x-1.7) and am also finding that the 100% width in my crop actions of the sub-presets are being processed as 100px.

#8

I think the problem is that canvasactions_aspect_image() in canvasactions.inc is described as using functionality from imagecache_build_derivative() but it omits some all-important logic around... percentage expressions.

The attached patch inserts that logic - copied straight from imagecache_build_derivative().

The patch was built against 6.x-1.dev but 6.x-2.dev has the same issue I believe.

AttachmentSize
610584-8.patch 1.66 KB

#9

If all that is necessary, that's a worry.
I'd have thought that _imagecache_apply_action() would do its own command parsing inside the action.
That's a problem with the imagecache process structure then, really.

If this really is the required fix, it may explain another odd side effect we've seen.

#10

Status:active» fixed

Yep.
Fixed in #626168: Aspect switcher (dev 2.0)

#11

Status:fixed» closed (fixed)

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