Option or button to let User Rotate Images

thomasmes

Member
Now that the image element supports 'Device Capture: Camera' automatic rotation or an option to rotate image is welcome. Pictures that are taken in portrait view are saved as landscape. If users can rotate the image or thumb afterwards, this would solve the problem. I do see a GD2 class for image rotation: http://fabrikar.com/docs/classes/FabimageGD2.html but I do not know how to implement this. can this be done via a calc element or list plugin?
 
Any words on this? Can this be done with the calc element or with the php list plugin, so that the image (path) is ran through Image Magick, something like:

http://php.net/manual/en/imagick.rotateimage.php
<?php
header('content-type: image/jpeg');
$imagick = new Imagick();
$imagick->readImage('{table___image}');
$imagick->rotateImage(new ImagickPixel(), 90);
print $imagick->getImage();
?>
 
Oh, sorry thought I'd replied. I looked at this, and the only workable way I could think of doing it would be with a list plugin. Either quick and dirty with the PHP plugin, or "properly" by creating a purpose built, configurable plugin.

BTW, I've tried every which way to get a "Image - camera" upload from my phone to orient incorrectly, can't do it. How are you actually winding up with images in the wrong orientation? Is it phone specific?

-- hugh
 
I think there's exif information of phone position.
I'm using the cloudinary API, they have an option "angle"="exif", which will return the image in correct orientation.

But like Hugh I can't get "wrong" images from my phone with the fileupload.
 
Last edited:
I wonder what phones you are using? I have a Samsung Galaxy S4 and only picture taken in landscape come through correctly.
 
OK, I've had a hack at automating this if the EXIF data is set for orientation:

https://github.com/Fabrik/fabrik/commit/c73254d368d483f9088161cb6c294dd530de4c93

So during upload processing, we'll check to see if EXIF orientation data is present, and rotate the image accordingly. I can't test it "for real", as my uploads have EXIF orientation of 1, meaning they have already been processed for the correct orientation. But if I run it in debug, and manually change that orientation value to force it to rotate, it does so.

It's a WiP feature, so you'll have to enable WiP on the element to test it.

I'm not sure how useful this will be, as I suspect most phones that don't handle orientation properly probably don't set the EXIF data. But who knows.

Let me know.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top