Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Images are rotated when resized

This discussion is related to the ImageUpload addon.
AaronWebsteyAaronWebstey Headband AfficionadoCole Harbour, NS ✭✭✭

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:
gharald

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.

    AaronWebstey
  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    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.

    AaronWebstey
  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    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.

  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    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?

    Bleistivt
  • 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.

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

    peregrinevrijvlinder
  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭
    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.

  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

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

    hgtonightBleistivt
  • LincLinc Director of Development Detroit Vanilla Staff

    Photos I used to test the PR.

  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

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

  • LincLinc Director of Development Detroit Vanilla Staff

    Thanks for tackling it!

Sign In or Register to comment.