0

I've been doing some digging, but so far with no results. I'm currently looking for a way of forcing or letting the admin to dictate the orientation of an image. I came across an issue where some user uploaded content looked correct upon initial upload, but when the admin began the approval process, the files hidden orientation data changed it from a vertical to a horizontal orientation. Now mind you I know that I could simply re-save that file, pull down the submitted post data and re-upload with the correct image, but I'm trying to be as efficient as possible in the event someone outside myself is administrating the content one day.

Has anyone come across a module that could help force orientation away from EXIF content or other data?

Thanks in advance!

5
  • using ImageMagick as your image handler will allow you to access some really, really powerful image manipulation tools. you should start there. Commented Apr 23, 2015 at 12:58
  • Thank you 5482. I'll give it a shot and update based on my findings. Commented Apr 23, 2015 at 13:00
  • Gave it a shot, but overall this option is not exactly what I'm going for. Nice tool though. This is more post upload, I'm looking to force the upload to respect from start. This may work as a secondary option. Commented Apr 23, 2015 at 13:37
  • I'll expand a bit in an answer below. Commented Apr 23, 2015 at 13:46
  • Could you please make title actual question? It would make it easier to find it, or to know if what you ask is in particular expert's area of knowledge - most people will not read a wall of text if they don't expect to be able to help from the very beginning, and nonspecific title does not help. Commented Apr 23, 2015 at 14:46

2 Answers 2

0

Once you've set up ImageMagick you can start using it in a file hook to process your images on upload.

Some good hooks to look at would be:

https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_file_presave/7

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_file_insert/7

Watch for an image being uploaded, read exif data with imagemagick, adjust accordingly.

3
  • Right, I understand that. But I want it to ignore the EXIF data and maintain the orientation at which it's being uploaded, not the information that EXIF is stating it should be working with. Commented Apr 23, 2015 at 13:50
  • By the sound of it, you may have got this backwards. Generally it's the original client that respects EXIF data and rotates the image accordingly. The uploaded copy does not take EXIF into account, hence it appears to have been rotated although in fact it hasn't. The exif_orientation module mentioned by @Matt Glaman addresses the issue. Commented Apr 23, 2015 at 15:22
  • Nope, I am understanding it correctly. My current website is using EXIF mod – Note: I turn it of and on based on my testing of resolutions to this issue – and it is indeed an issue with the files EXIF data. I've saved different versions of the image so that the I have all of the possible options to work with. The interesting point to me is that the file uploads correctly no matter what in the upload process, and in the file system shows up properly orientation wise, but when I accept and attach the file during the approval process, the image re-orients to the wrong orientation. Just strange. Commented Apr 23, 2015 at 19:03
0

We had this issue and put up a module that fixes orientation based on EXIF data. Link to project https://www.drupal.org/project/exif_orientation

No need for ImageMagick.

2
  • Hi Matt, and thanks for your post. I'd mentioned before it's the EXIF data that's actually causing the complication. What I'm looking to do is ignore the EXIF data and force it to upload the way it's put into the form instead of any underlying exif data that may be trying to rotate it. Commented Apr 23, 2015 at 15:38
  • Ah, I misunderstood the situation. In testing only viewing the picture directly in Chrome or proper picture viewer would images display properly. Otherwise (iOS uploads in our case) the image would not be rotated properly until we did so in our hook. Commented Apr 23, 2015 at 15:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.