Closed (fixed)
Project:
ImageCache Actions
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Sep 2011 at 08:57 UTC
Updated:
11 May 2012 at 20:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
yelvington commentedVerified, clean install.
Warning: exif_read_data(P1010582.JPG): Invalid JPEG file in imagecache_autorotate_image() (line 94 of /web/sitename/htdocs/sites/all/modules/imagecache_actions/autorotate/imagecache_autorotate.module).
Comment #2
yelvington commentedThis is probably the more interesting error message:
Warning: exif_read_data(P1010582.JPG): Error reading from file: got=x3FFA(=16378) != itemlen-2=x7D9A(=32154) in imagecache_autorotate_image()
I get this logged immediately before the "invalid JPEG file" message. The numeric values are identical on multiple images.
Comment #3
yelvington commentedApologize for spamming this issue, but the PHP documentation http://php.net/manual/en/function.exif-read-data.php says "The name of the image file being read. This cannot be an URL." Does this work with the public://filename stream wrapper?
Comment #4
yelvington commentedOK, there are two problems with this module. One is the stream wrapper problem, which can be fixed by handing the stream uri to drupal_realpath in line 94:
$exif = exif_read_data(drupal_realpath($image->source));
Once you do this, the action fails because D7 has renamed imageapi_image_rotate. In line 115:
image_rotate($image, $degrees);
Being too lazy to wrestle with patch, I've attached a fixed version of the file imagecache_autorotate.module.
Comment #5
yelvington commentedComment #6
millionleaves commentedThis fixed version has resolved the issue I was having. Basically, the image wasn't being created if it needed to be rotated. It is now.
Caveat: When troubleshooting, I didn't find any errors in the Drupal log and didn't dig any deeper, so I can't be sure that this hasn't introduced any new issues.
Comment #7
wonder95 commentedConfirmed that both this issue happens and the "patch" works for me.
Comment #8
wonder95 commentedHmmm, it looks like this fix was already partially applied here. However, the 7.x-1.x branch still has the invalid call to image_rotate_effect(). The attached patch cleans up the unnecessary $realpath variable definition and changes this incorrect call
to
Comment #9
fietserwinAdded your change plus some more changes:
- parameter passing to image_autorotate failed as it expects separate parameters, not an array with parameters.
- added error handling for the case whne the PHP exif extension is not enabled.
- dimensions callback setting was missing for the effect info.
- failed to alter current dimensions on a 90 or 270 degrees rotation with imagemagick.
The latter is a bug in imagemagick toolkit. I will create a separate issue over there.
Comment #10
fietserwinRelated issue in imagemagick toolkit: #1551262: Rotate should alter dimensions.
Comment #11
wonder95 commented@fietserwin, did you mean to attach a patch? I don't see one from you.
Comment #12
fietserwinCommitted... I am the new co-maintainer.