Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Images are rotated when resized

Hi,
I'm using the wonderful ImageUpload on 2.1.6, and some images are getting turned sideways or upside-down after uploading. I've been sorting through the plugin and core image upload code, and nothing is popping out at me (I am a PHP developer but pretty new to VF in particular). Is this just the flakiness of exif tags on different camera devices, or have you seen/heard of this before?

Tagged:

Comments

  • It's the way people upload images.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks @peregrine‌. Not sure exactly what you mean, but at least I can stop looking in the code for answers. If you can elaborate I'll appreciate it; otherwise I still appreciate it and I'll just see if I can reproduce the problem using my own uploads and tell my users what not to do.

  • peregrineperegrine MVP
    edited December 2014

    this should give you some insights and a possible solution.

    http://vanillaforums.org/discussion/24908/image-upload-orientation-changer

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks again. I did briefly read that before, but should have looked more closely. I've asked a user to send me an original copy, so that I can let him know that his original image was not right. I'm hoping I won't have to implement the rotator, but as the forum is getting popular pretty quickly I probably will.

  • Update: I got a couple of original images from a poster. According to exiftool, they have an "orientation" attribute defined, which doesn't appear to be handled by SaveImageAs in class.uploadimage.php. The images are properly oriented when I view them on my desktop (Mac), but it looks like the SaveImageAs code simply reads the width/height attributes and ignores the request to rotate.

    @peregrine‌ Would it be desirable to handle this attribute? If so, should I add code to class.uploadimage.php to support it, or somehow try to modify the plugin code? Also, any opinion on whether I should try to actually rotate the image in the code or just pass the exif tag through and let the browser decide if it wants to rotate it?

  • peregrineperegrine MVP
    edited December 2014

    Would it be desirable to handle this attribute?

    if you can find a reliable exif reader to incorporate more power to you.

    http://php.net/manual/en/function.exif-read-data.php

    you might want to clone your own plugin and then when you have it working reliably on all browsers, all cameras, and all image types - just post your plugin.

    and or send changes to chuck, when you have them working and tested, and he could add it if he wants.

    haven't looked into this but it may be useful too:

    http://lsolesen.github.io/pel/doc/

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • It'd be cool if the UploadImage would handle that, created an issue.

  • AaronWebsteyAaronWebstey ✭✭✭
    edited December 2014

    Thanks @Bleistivt‌ . Are there any guidelines for testing forum development? I.e. required testing procedures, etc. I've read the pull request guidelines, so I'm getting an idea of how to help out (although I'm an old-school CVS guy and still learning how Git works in my 'spare' time). However, I can't seem to find any specifics about testing requirements if I do end up trying to address the issue you created (am I even allowed to do this)?

  • you can submit pull request. the developers decide if they want to merge it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @Bleistivt‌ , as per your request in another thread, I've submitted a PR for my fix to this.

  • Photos I used to test the PR.

  • Thanks @Linc‌ , I'll see if those work on my site tomorrow.

  • Thanks for tackling it!

Sign In or Register to comment.