The rotate effect should alter the dimensions in the $image->info array. For 0 and 180 degrees it remains unchanged for 90 and 270 degrees they should be swapped. For other degrees it comes down to a formula that can be found in the related Drupal core issue #1551686: Image rotate dimensions callback can calculate new dimensions for every angle.

Comments

fietserwin’s picture

Formula from: http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-...

o = angle
new x = x * sin(o) + y * cos(o)
new y = x * cos(o) + y * sin(o)

image_rotate_dimensions() in image.effect.inc in Drupal core should do the same: #1551686: Image rotate dimensions callback can calculate new dimensions for every angle

And another link that explains it: http://actionscripthowto.com/bounding-box-of-a-rotated-rectangle/

fietserwin’s picture

The formula above only works fin the 1st quadrant. I found a complete example and converted it into working Drupal PHP code (including tests) in the Drupal core issue #1551686: Image rotate dimensions callback can calculate new dimensions for every angle. It can be copied right into this module or if and when it becomes available in D7, this module can call the core code directly.

Please review and comment over there.

fietserwin’s picture

Issue summary: View changes

Updated issue summary.

mondrake’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 7 is EOL