Clockwise = Counterclockwise and vice versa

technivant - July 25, 2007 - 16:17
Project:Acidfree Albums
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

This module is sooo intuitive. My mother-in-law is going to love it.

However, it seems that when I select Rotate Image "clockwise" it actually rotates counterclockwise and vice versa. My server doesn't have exiftran or jpegtran, so I gather it's using imagemagick? or gd? since it is doing some rotation (albeit the wrong way). Has anyone else seen this behavior? Can/should Acidfree pass the rotation value to the lossy rotator differently?

Incidentally, when the node is submitted, the aspect ratio of the image changes but the image itself is still oriented as the original (so it appears stretched or squeezed). Only when the browser is refreshed does it appear correctly. Might this be a matter of the image handler package, too?

thanks!

#1

vhmauery - July 25, 2007 - 21:47

People have come at me time and time again with this problem. This has got to be a GD bug. I imagick on my system and it works fine for me. For some reason GD on my system doesn't have the rotate function enabled. But with imagick, rotation goes the right way. I don't know how to fix this for you without breaking it for me. That is, I don't know how I can detect this situation.

One thing you can try is my toolkit_test.php program. Put it in your drupal root and point your browser to it. without any arguments it will give you usage help. Try something like this:
http://yoursite.dom/drupal/toolkit_test.php?img=/path/to/image.jpg&resiz...
That should give you a resized version of /path/to/image.jpg that is scaled down to 240 pixels in the largest direction and rotated 90 degrees clockwise.

As for the images that look squished or stretched after a rotation, that is because your browser caches stuff.

AttachmentSize
toolkit_test.php_.txt1.62 KB

#2

bittindm - November 8, 2007 - 20:26

I've experienced the same issue and decided to swap the labels in class_image.inc if the GD toolkit is detected. Kind of a hack because it's only changing the text and not correcting the values but it works.

<?php
if ('gd' == image_get_toolkit()) {
   
$rotate_options = Array(
       
'270' => t('Clockwise'),
       
'0' => t('No rotation'),
       
'90' => t('Counterclockwise'),
       
'auto'=>t('Use exif orientation tag'),
    );
} else {
   
$rotate_options = Array(
       
'270' => t('Counterclockwise'),
       
'0' => t('No rotation'),
       
'90' => t('Clockwise'),
       
'auto'=>t('Use exif orientation tag'),
    );
}
?>

#3

vhmauery - February 18, 2008 - 01:01
Status:active» patch (code needs review)

If all you are doing is modifying the text, you can do that with translations. The text is all wrapped by t() calls, so it would be trivial for you to do that. Since it is a hack, I don't really want to apply the patch that you have provided.

I like this hack better, but still... This just doesn't feel right.

Index: class_image.inc
===================================================================
--- class_image.inc     (revision 533)
+++ class_image.inc     (working copy)
@@ -83,6 +83,9 @@

function _class_image_rotate(&$node) {
     if ($node->rotate != 0) {
+        if (image_get_toolkit() == 'gd') {
+            $node->rotate -= 180;
+        }
         $large_path = file_create_path($node->images[IMAGE_ORIGINAL]);
         acidfree_rotate_image($large_path, $node->rotate);
         $filesize = filesize($large_path);

#4

vhmauery - March 6, 2008 - 15:06
Status:patch (code needs review)» fixed

fixed in CVS.

#5

Anonymous (not verified) - March 20, 2008 - 15:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.