Ipad image orientation

Permalink Browser Info Environment
Hi John
Is it possible to add some code that will auto orientate images that are uploaded with an exif orientation tag embedded,
In particular Ipad images,
The code (and explanation) below was created to overcome the problem of orientation tags not being recognised,
When the new update came out from Apple for iOS6 it provided the ability for iPad, iPod, and iPhones to be able to upload files from the device through Safari. Obviously this will open up an array of implementations where at one point it was just not possible.
The issue comes when a photo is uploaded it will be dependent on the location of the "button" when the photo was taken. Imagine if you will that you have your iPhone turned with the button at the top and you take a photo. The photo when uploaded to your server might be "upside down".
The following code will ensure that all uploaded photos will be oriented correctly upon upload:
$image = imagecreatefromstring(file_get_contents($_FILES['image_upload']['tmp_name']));
$exif = exif_read_data($_FILES['image_upload']['tmp_name']);
if(!empty($exif['Orientation'])) {
    switch($exif['Orientation']) {
        case 8:
            $image = imagerotate($image,90,0);
        case 3:
            $image = imagerotate($image,180,0);
        case 6:

I have no idea if this could be implemented, but it would be very helpful if it could,

Type: Discussion
Status: Archived
View Replies:
JohntheFish replied on at Permalink Reply
Its an interesting idea. At the moment, any image uploaded is left at whatever rotation it is provided at. So I can see that any further data that says the provided rotation is not what was actually intended could be a useful addition.

Maybe the place to implement this would be within the c5 image helper, because I can see it being useful to more than just this addon.

A risk of following any such data is that it gets followed too many times :(, so I will need to be sure that could not happen.

I will add this to my list of things to look into next time I upgrade Front End File Uploader.
weyboat replied on at Permalink Reply
It would indeed be useful and I think appropriate to be included in the concrete5 core,
When images are uploaded to Facebook (and some other sites) the exif data is read and the image is presented as the up-loader intended, of course this is happening in the background without the up-loaders knowledge,
The problem arises when the same image is uploaded to a concrete site and the image is not presented in the "intended" orientation..
The up-loader does not accept that the image was uploaded in the wrong orientation because "It works on Facebook!",
Anyway thank you for considering my proposal,
JohntheFish replied on at Permalink Reply
Your post arrived as I was writing a post about this on the Leaders forum.


I think the issue is sufficiently global that we continue discussion there.
JohntheFish replied on at Permalink Reply
Front End File Uploader v2.0 update:

While many new features have been added for version 2.0, image rotation is not one of them.

Nevertheless, the code has been structured to facilitate anyone wanting to experiment with image rotation by overriding the helper 'packages/jl_front_end_uploader/helpers/extended_image.php'.

Within the override, returning true from auto_rotate_support() will add an option to the block edit dialog and result in extended_create() being called to process uploads when image rotation is subsequently selected from the edit dialog.

It is up to anyone experimenting to code the body of extended_create() to rotate images.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.