Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 02-22-2015, 10:44 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, it does work for thumbnails, but the added line has to go in a different place than I thought. I added it near the beginning. Here's my code fragment, from includes/class_image.php, around line 760 (I added the line in red):

Code:
		if ($thumbnail)
		{
			// Only specify scene 1 if this is a PSD or a PDF -- allows animated gifs to be resized..
			$execute .= (in_array($imageinfo[2], array('PDF', 'PSD'))) ? " \"{$filename}\"[0] " : " \"$filename\"";
		}
		else
		{
			$execute .= " \"$filename\"";
		}
        $execute .= ' -auto-orient ';

		if ($imageinfo['scenes'] > 1 AND version_compare($this->version, '6.2.6', '>='))
		{
			$execute .= ' -coalesce ';
		}
So, that's at least a small improvement since the thumbnails will look right.

Oh, I added that line to the code then went to the admincp, Maintenance > General Update Tools > Rebuild Attachment Thumbnails. But that will probably take a long time (it took me a minute and I only have a few test attachments), so you'd probably want to try it first by attaching a new image, or maybe don't run the rebuild but just let it work for new images, if you've been fixing the existing ones.
Reply With Quote
  #12  
Old 02-22-2015, 10:56 PM
Bill Stuntz Bill Stuntz is offline
 
Join Date: Feb 2015
Location: Columbus, OH
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works differently in different browsers, too. FF & Chrome behave differently than IE & Safari. At least, I THINK I have the browsers right - it's been a while since I tested them all when people were saying that the different size views displayed differently. In some browsers, the thumbnails & magnified views display in different orientations. In others, they're all sideways.

With multiple execute's, can the FIRST one that executes correct the orientation, and later ones do the resize & thumbnail creation as more passes through IM are made for the other views? Or does only 1 execute happen? With all those IF's I'm not sure yet whether more than one execute actually occurs before the process completes.
Reply With Quote
  #13  
Old 02-22-2015, 11:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll have to look at things more closely when I get a chance. As I mentioned above I got the thumbnails to orient themselves, but the larger image that pops up still isn't right and I'm not sure why. Also, when you attach an image then edit the post you can double click and bring up a popup that lets you change the size, but once I did that nothing looked right any more, even when I went back to thumbnail.
Reply With Quote
  #14  
Old 02-23-2015, 12:02 AM
Bill Stuntz Bill Stuntz is offline
 
Join Date: Feb 2015
Location: Columbus, OH
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We've been correcting the images as we find them, so the rebuild probably isn't necessary for us. And I've noticed that IM seems to strip out the orientation & camera info tags when it resizes. So if it's resized first, there's no exif orientation tag to trigger the rotation. The only way I was able to track down the problem was by examining the few photos that were taken at low enough resolution that IM hadn't resized them as they were uploaded/stored on the MB. I used JPEGsnoop to see/analyze several of the weird photos. I've had a few users email me the original (untouched by IM) photos for comparison. The image quality ON SCREEN after resizing is ALMOST as good as the original. It's good enough to see most of the essential details, but not good enough for true archival/research work. If you'll give me your email in a PM, I'll send you a few if you want.

IMHO, the proper order of operations is: Rotate the full size photo if it contains an exif orientation tag, THEN generate the other views, with the largest view resized down to 1600W for storage after rotation to make the resulting image as large as reasonable for our available storage & bandwidth. Normally, 200x200 thumbnails are visible in the posts, and users can get progressively larger views by clicking on the visible photos.
Reply With Quote
  #15  
Old 02-23-2015, 12:33 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The issue is not the forum software, the issue are the phones taking the pictures and only saving orientation data instead of actually rotating the picture correctly in the first place.

While I think it's worthwile to fix the problem in vBulletin, its unlikely to get backported to vBulletin 4.

kh99, if the image isn't over any limits, we don't do any modifications to it. I'm guessing that you're going to need to write something to check if the image has the orientation metadata and then do something based on that to fix the image when we do image checking from the original upload.
Reply With Quote
  #16  
Old 02-23-2015, 02:02 AM
Bill Stuntz Bill Stuntz is offline
 
Join Date: Feb 2015
Location: Columbus, OH
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree, the problem is only with the iPhone, Canon, Nikon and maybe a few other cameras. But it will probably get worse as cameras & cell phones improve and prices go down.

There are a LOT of iPhones out there - and they're not going to go away. I'm not sure, but ios8 may have fixed the problem - but that's just speculation. I haven't seen enough photos that I'm SURE are ios8. That info gets stripped out of the jpg's in the resize, and I never see the original photos to be sure. And I don't have an iPhone to test.
Quote:
I'm guessing that you're going to need to write something to check if the image has the orientation metadata and then do something based on that to fix the image when we do image checking from the original upload.
Please don't take this as an insult, but if I'm not mistaken, adding that "-auto-orient" early in the process might be an easy way to fix the problem for everyone - IF it works. And I'm not a good enough programmer anymore to find out. I haven't done any serious programming since CP/M days, when I wrote a text editor in 8080 assembler because I hated edlin so much, and couldn't afford to buy a screen oriented editor instead of the line oriented one that was built into CP/M.

Do the rotation first if the orientation metadata is there, and THEN figure out whether it needs to be resized, etc. and do the rest of the processing. I've seen quite a few complaints about this problem on our MB and elsewhere, and I think it occurs in 5, too. I have no idea how they do it, but a lot of other web sites DO automatically orient the photos properly, so it's obviously NOT impossible.
Reply With Quote
  #17  
Old 02-23-2015, 03:47 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bill Stuntz View Post
Do the rotation first if the orientation metadata is there, and THEN figure out whether it needs to be resized, etc. and do the rest of the processing. I've seen quite a few complaints about this problem on our MB and elsewhere, and I think it occurs in 5, too. I have no idea how they do it, but a lot of other web sites DO automatically orient the photos properly, so it's obviously NOT impossible.
Yeah, I think that's going to work. With the -auto-orient that I've got in there now, the thumbnail works and the original size works, but the intermediate "lightbox" image doesn't for some reason I don't understand. But what I did was took the sample image and ran the command line IM program on it with only the -auto-orient option, and that image works completely. The only problem is that I don't think there's anywhere to just add the -auto-orient, so it's like Zachery said, we need to find the point just after it's been uploaded and add a call to do the conversion. That shouldn't be too hard, I think it's uploaded to a temp file before anything's done to it.
Reply With Quote
  #18  
Old 02-23-2015, 05:52 AM
Bill Stuntz Bill Stuntz is offline
 
Join Date: Feb 2015
Location: Columbus, OH
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I hope my insights have you pointed in the right direction.

I've noticed that some browsers ALWAYS display them wrong, and others seem to get it right for some magnifications. Maybe lightbox is still working with the un-rotated image after it's actually been rotated into the new file? Or does its thing too soon, before it's rotated - and the thumbnail is generated after rotation? There are so many IF's in there that I'm not sure. Maybe more than 1 -auto-orient is needed?

It sure would be nice if there's an easy fix for ALL of us, even if it only works for future photos. I can live with that. It will save me a lot of trouble.
Reply With Quote
  #19  
Old 02-23-2015, 10:48 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My point was to help get kh99 on the right track, and explain the problem.
kh99, there is a check in the IM processing part of the class_image to check the filetype, maybe you can run some code there.

Mobile devices read and recognize the metadata, browsers don't care. Maybe they should, but they don't.
Reply With Quote
  #20  
Old 02-23-2015, 12:30 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I wanted to explore Bill's idea of adding -auto-orient, and since it turns out that fetch_thumbnail does all the resizing, and it's easy to add the option there, then I thought that might work. But as I said, the lightbox image doesn't work and I'm not sure why. But rather than track that down, I think it's better to try what Bill said and rotate it if necessary before doing anything else. A couple years ago I was working on a mod that read and displayed EXIF data from upload files that had it, so I know there's a hook where you can work on the uploaded file before anything else is done to it. I've just been looking in to that and I believe newattachment_start will work. So it's just a matter of writing the code to exec the IM programs using the temp file name, convert it to a new temp file name, then replace the name in $_FILE. It would be nice to use the existing code in the IM class, but that would mean modifying the file.

In any case I think I'm pretty much there and it's just down to the details of implementing it.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:28 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10090 seconds
  • Memory Usage 2,281KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete