MyBB Community Forums

Full Version: Image Auto-Resizer 1.1.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
In the past I have had problems with rotated images. One member is the butt of a standing joke as Don's School of Photography. The problem seems to stem from how his iPhone captures exif data in images taken by a left-handed operator. The last couple of years his images are oriented properly on upload. Whether it is iPhone software related, or how he holds the phone differently, I don't know.

I installed the Image Auto-Resizer plugin 1.0.2, and a recent pair of images from him were rotated, thus reviving the old joke.

It might help to capture the original images for analysis. Right now, I only have the resized altered images available. I'll see what I can do.

It is interesting how different systems report this image.
The original image is created on an iPhone in portrait mode.

It was sent to me by phone MMS, obviously it got downsized. Android details show it as 960x1280, no tags, no exif.
It was uploaded through 1.0.2 Resizer plugin 3 days ago and was rotated. Image dimensions: 2,100px × 1,575px
Probably because when I look at original image details on Android it is reported as 4032x3024, no location, no tags.
Oddly, Android orients the image correctly.
And when uploaded to the forum without resizing, it orients correctly.

Gimp reports there is exif data.

Later today, I will test the revised plugin. I do have have exif module loaded.

Upload limits prevent screenshot and images dropped here.

Dropbox share link created and PM'd.

... (deleted)

... (deleted)

I may have goofed up the settings and/or which version was running. I went through a number of iterations. I reported success, then mixed success, then this.

I was mistaken. On the test server the images are rotated after I Ctrl-F5 and display the page.
On the production server, images are rotated and I receive the Warning in the screenshot.

More info on the error.
Your copy of MyBB running on Production Server has experienced an error. Details of the error include:
---
Type: 2
File: inc/plugins/auto_resizer.php (Line no. 233)
Message
imagejpeg() expects parameter 1 to be resource, string given
Back Trace: #0  errorHandler->email_error(2, imagejpeg() expects parameter 1 to be resource, string given, inc/plugins/auto_resizer.php, 233) called at [/home/hlf/public_html/forum/inc/class_error.php:195]
#1  errorHandler->error(2, imagejpeg() expects parameter 1 to be resource, string given, inc/plugins/auto_resizer.php, 233, Array ([filepath] => ./uploads/202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach,[imgsz] => Array ([0] => 4032,[1] => 3024,[2] => 2,[3] => width="4032" height="3024",[bits] => 8,[channels] => 3,[mime] => image/jpeg),[create_func] => imagecreatefromjpeg,[imgtype] => jpeg,[save_func] => imagejpeg,[image] => Resource id #29))
#2  imagejpeg(./uploads/202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach) called at [/home/hlf/public_html/forum/inc/plugins/auto_resizer.php:233]
#3  autorsz_fix_image_orientation(./uploads/202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach) called at [/home/hlf/public_html/forum/inc/plugins/auto_resizer.php:250]
#4  autorsz_resize_file(202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach) called at [/home/hlf/public_html/forum/inc/plugins/auto_resizer.php:208]
#5  autorsz_hookin__upload_attachment_thumb_start(Array ([pid] => 0,[posthash] => 8072ae9abdb2462fa4c7aff3fc45732a,[uid] => 1384,[filename] => CC68682B-F95F-4B0F-87D9-D1B20073CE64.jpeg,[filetype] => image/jpeg,[filesize] => 2520548,[attachname] => 202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach,[downloads] => 0,[dateuploaded] => 1635379729)) called at [/home/hlf/public_html/forum/inc/class_plugins.php:142]
#6  pluginSystem->run_hooks(Array ([function] => autorsz_hookin__upload_attachment_thumb_start,[file] => ), Array ([pid] => 0,[posthash] => 8072ae9abdb2462fa4c7aff3fc45732a,[uid] => 1384,[filename] => CC68682B-F95F-4B0F-87D9-D1B20073CE64.jpeg,[filetype] => image/jpeg,[filesize] => 2520548,[attachname] => 202110/post_1384_1635379729_8ccbc314be87a35aec16b61d1a2cdee3.attach,[downloads] => 0,[dateuploaded] => 1635379729)) called at [/home/hlf/public_html/forum/inc/functions_upload.php:605]
#7  upload_attachment(Array ([name] => CC68682B-F95F-4B0F-87D9-D1B20073CE64.jpeg,[type] => image/jpeg,[tmp_name] => /tmp/phplj3pFk,[error] => 0,[size] => 2520548), ) called at [/home/hlf/public_html/forum/inc/functions_upload.php:792]
#8  add_attachments(0, Array ([gid] => 9,[type] => 2,[title] => Administrators,[description] => The group all administrators belong to.,[namestyle] => <span style="color: #816400;"><strong><em>{username}</em></strong></span>,[usertitle] => Administrator,[stars] => 8,[starimage] => images/star.png,[image] => ,[disporder] => 0,[isbannedgroup] => 0,[canview] => 1,[canviewthreads] => 1,[canviewprofiles] => 1,[candlattachments] => 1,[canviewboardclosed] => 1,[canpostthreads] => 1,[canpostreplys] => 1,[canpostattachments] => 1,[canratethreads] => 1,[modposts] => 1,[modthreads] => 1,[mod_edit_posts] => 1,[modattachments] => 1,[caneditposts] => 1,[candeleteposts] => 1,[candeletethreads] => 1,[caneditattachments] => 1,[canviewdeletionnotice] => 1,[canpostpolls] => 1,[canvotepolls] => 1,[canundovotes] => 1,[canusepms] => 1,[cansendpms] => 1,[cantrackpms] => 1,[candenypmreceipts] => 1,[pmquota] => 1000,[maxpmrecipients] => 25,[cansendemail] => 1,[cansendemailoverride] => 1,[maxemails] => 5,[emailfloodtime] => 5,[canviewmemberlist] => 1,[canviewcalendar] => 1,[canaddevents] => 1,[canbypasseventmod] => 1,[canmoderateevents] => 1,[canviewonline] => 1,[canviewwolinvis] => 1,[canviewonlineips] => 1,[cancp] => 1,[issupermod] => 1,[cansearch] => 1,[canusercp] => 1,[canuploadavatars] => 1,[canratemembers] => 1,[canchangename] => 0,[canbereported] => 1,[canchangewebsite] => 1,[showforumteam] => 1,[usereputationsystem] => 1,[cangivereputations] => 1,[candeletereputations] => 1,[reputationpower] => 10,[maxreputationsday] => 250,[maxreputationsperuser] => 0,[maxreputationsperthread] => 10,[candisplaygroup] => 1,[attachquota] => 500000,[cancustomtitle] => 1,[canwarnusers] => 1,[canreceivewarnings] => 1,[maxwarningsday] => 10,[canmodcp] => 1,[showinbirthdaylist] => 1,[canoverridepm] => 1,[canusesig] => 1,[canusesigxposts] => 0,[signofollow] => 0,[canundorating] => 1,[edittimelimit] => 0,[maxposts] => 0,[showmemberlist] => 1,[canmanageannounce] => 1,[canmanagemodqueue] => 1,[canmanagereportedcontent] => 1,[canviewmodlogs] => 1,[caneditprofiles] => 1,[canbanusers] => 1,[canviewwarnlogs] => 1,[canuseipsearch] => 1,[cnv_canstart] => 1,[cnv_max_participants] => 15,[canonlyviewownthreads] => 0,[canonlyreplyownthreads] => 0), posthash='8072ae9abdb2462fa4c7aff3fc45732a', newreply) called at [/home/hlf/public_html/forum/newreply.php:222]
Oops. That's a mistake on my part. Now that I check my own error logs, I see the same error.

Have now:
  • Added the missing parameter.
  • Found an image with EXIF data that I can manipulate and test on.
  • Tested and found the code to be working as intended.
  • Zipped up a prerelease-3 version of the code and attached it to this post.

Hopefully your tests succeed this time, HLFadmin!
Success, production server is working well.
Thank you Laird. This plugin is a real space saver.

At the cost of using a member's bandwidth to upload larger images from their phones, resizing them on the server eliminates a step for them on their phone before uploading. The benefit is saving space on the server.

Will continue to monitor for anomalies, but it seems the Don's School of Photography joke can take a rest. Thanks.
Version 1.0.3 has been released, with the new feature as developed in recent posts in this thread:
  • Where supported, eliminates unintended image rotation on resize due to "orientation" EXIF data being lost.
Upgrade from previous version is simply by replacing files, or requires deactivation before?
Simply replacing files should be fine. No need for deactivation/reactivation.
Thanks!
Version 1.0.4 has been released, with the new feature and fix:
  • Bugfix: The file size bug introduced in v1.0.3 has been fixed. This bug led to issues with the display of images via attachment.php (partial rendering; failed downloads). Corrective code has been added so that these issues are no longer experienced for already-uploaded images too.
  • The support for auto-orientation has been improved so that it implements the full set of eight possible Exif orientation types.
Images uploaded with Safari and v1.0.3 may still be broken with v1.0.4.
Performing some incremental testing on live forum, waiting on my content provider.

Test is post an image thread with 1.0.4 installed but deactivated,
Then Activate and post new thread,
Then evaluate threads with and without plugin activation.

Funny thing is Firefox displays all regardless.

I have removed the plugin from production server.
Deactivating the plugin then posting an image thread resulted in no problems viewing all images in Safari on a MacBook, iPad and iPhone.
The thread was created from a Safari browser on MacBook.

After activating the plugin, images failed to load in a Firefox browser.

Production server is running 1.8.26
I will upgrade test server to 1.8.29, then resume testing.
As a followup, I have upgraded production to 1.8.29, and am running Auto-Resizer 1.04 successfully.
One problem is it still throws an error if the database says an attachment is there, but the file is not on the server.
Pages: 1 2 3 4 5 6 7