I'm having problems with portrait jpgs getting rotated properly but displaying as squished/cropped in single picture view. This is a fresh install of latest stable with all default settings, with the exception of the enabling of auto rotate, and the default theme.
I get the following results with portrait JPGs straight off my Canon 7D:
1) Thumbnail jpg is rotated just fine, looks good.
2) Single photo view jpg is rotated fine (I can verify this by right clicking the image and selecting "View image" in Firefox) but displayed as landscape, stretched horizontally and cropped vertically.
3) Full original jpg rotated properly.
This happens with all new, never-before-databased images as well, so it's not an issue of the database remembering image dimensions before enabling auto rotate.
Any thoughts? Could an older library of something outside of zen be to blame, and if so, what would be the likely culprit?
Comments
The actual jpg is indeed being properly rotated/resized. If I download the image or right click it to view just the JPG itself, it is properly sized - in this case, 397x595 pixels.
The display size, however, is set to 595x397 pixels. So if I right click the image in Firefox and choose properties, it says: "397px × 595px (scaled to 595px × 397px)"
As for a theme / CSS being the cause, as I mentioned, this is a fresh install of zen downloaded and installed just a few hours ago. I have literally done nothing but enabled auto rotate - everything else is pure default. So no 3rd party themes or other tinkering going on. It just seems like the image is being handled properly, but the database is not getting the final display size correct.
One interesting thing though is that I went into the edit function of a random image, and I noticed the option to rotate is grayed out. This is increasingly making me think I have a weird or old version of some library that zen depends upon that is to blame.
Any thoughts?
Regarding libaries what does setup tell you? If the rotate option is greyed out you either don't have the option checked or your the GDlibary on your server does not support it.
PHP version 5.2.2
Graphics support: PHP GD library bundled (2.0.34 compatible)
MySQL version 5.0.41
All green checkmarks for the various PHP, GD, and MySQL requirements.
-----------------
sbillard: I did state "This is a fresh install of latest stable with all default settings, with the exception of the enabling of auto rotate, and the default theme." in my first post and reiterated that point in my second post as well.
Indeed, everything is default: the theme, the theme settings, regular settings - absolutely everything - with the exception of the "Auto rotate" button I checked on the Image options page.
But just to be sure I wasn't stupidly forgetting something else I had changed, I just did the following sanity check:
1) Downloaded zenphoto-1.2.8_RC1.zip off of the home page, extracted to new zentest folder on my server.
2) Created fresh zen2 database, copied zp-config.php.source to zp-data and configured mysql login info accordingly. Did "chmod 777 zenphoto -R" to quickly take care of all permissions issues, just for this test.
3) Ran setup, all green checkmarks on the program stuff. Created admin user. Logged in.
4) Checked "Auto rotate" on Image options page, but touched *nothing* else.
5) Put a "Test" folder in albums, full of two straight-off-the-camera portrait JPGs from my Canon 7D, and one portait jpg from my old Canon 350D.
The results? Exact same problem. Properly rotated jpgs across the board, but in single picture view the image is again stretched and cropped, smashing a portrait image into the display size of a landscape. (And just in case it's relevant, I get the same view in both Firefox 3.5 and Internet Explorer 8.)
Given that strict test methodology, it seems like it *has* to be either an intrinsic bug in zen (not bloody likely, I suspect) or a server / library problem on my end.
It's almost as if the metadata is not being refreshed automatically after the rotate. Is it possible this is actually a bug?
Also, after the metadata refresh, the option to rotate becomes available in the image settings
The only other thing I have seen like this is when you have viewed the image before rotation, rotate it, and then revisit the page. For some reason sometimes the image is refreshed but the actual page is not so the image gets squished into the old html width/height settings.
It seems like the images are being rotated (as in, the physical jpgs generated are properly rotated) but the metadata accompanying the image that tells zen how big to display the image, etc.. is not being updated after the rotation. Instead, it's using the default, non-rotated metadata.
As for viewing the images before rotation, I too thought that might be causing issues, either because of my browser caching or zen itself. That's why on my most recent sanity check (where I redid everything from scratch) I specifically used new images that I had never uploaded before, and I did not put them in the albums folder until *after* I had set the auto rotate function.
So, the error shows itself with a fresh all-default install (with the exception of auto-rotate turned on) and never before uploaded or viewed images. And it the problem is fixed immediately upon performing a metadata refresh.
I guess I could just get into the habit of refreshing the metadata everytime I add pictures to my site, but the tinkerer side of me wants to figure out the root of the problem.
The thumbnails are fine. It's just the single image that is stretched horizontally.
I too can update the metadata after every upload, but that seems like a poor solution. I'm using Zenphoto version 1.4.2.2 [9365]
thanks for any help!
`UPDATE gallery_images SET height = '', width = '' WHERE filename = "IMG_0001.JPG"`
I then refreshed the image in the gallery and the image was displayed in the correct orientation and the correct width and height. As an extra caution, I ran the same query for all of the files in the database by omitting the `WHERE` clause.
I use rsync to upload my photos directly to the albums/ directory. I do not use the admin pages, which might be some of the reason why I had seen this issue.