I am using Form2Content Pro version 6.17.4 with Joomla 3.9.16
Hi,
I have a problem with the Image-Gallery-Field,
when I upload an image with an iPhone (iPhone SE or iPadPro),
I click the "Browse"-Button, then 'take a photo',
then I take a photo in portrait and click on "use this photo"
then the photo will be uploaded and …
… it shows landscape instead of portrait.
What I found out:
it seems to be, that an iPhone lets the image pixels always in landscape
and puts the orientation information into the EXIF informations.
After the upload it has to be corrected and I found the correction code here:
https://stackoverflow.com/questions/22308921/fix-ios-picture-orientation-after-upload-php/22475806
On stack overflow they discuss exactly the problem I have.
Is there a chance, that this will be corrected automatically?
or, that would help, have a Button to turn an image into one direction (left or right, on direction is enough)?
Thanks for any help,
Frederic
PS.: The same problem if I use images from my gallery on the iPhone
Form2Content Forum
Questions and answers for Form2Content, a Joomla CCK.
- Frederic Espitalier
- F2C field types
- Monday, 16 March 2020
- Subscribe via email
Accepted Answer
Pending Moderation
Hi Frederic,
I will ask our programmer to have a look at the code and see what can be done.
Regards,
Patrick
I will ask our programmer to have a look at the code and see what can be done.
Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so
- more than a month ago
- F2C field types
- # 1
Accepted Answer
Pending Moderation
Hi Patrick,
thanks for Your reply.
Here I give You an example including an imagefile of an iPhone SE
I checked it online with http://metapicz.com
The Mac (OSX) automatically rotates it, but surely not on web pages.
I checked it with an android-phone: no problem because it rotates it when saving the file.
the webpage using F2C:
https://schoolbook.solutions/index.php/18-solution/uni-fh/uni-mathe-walz-mathe-fh-2-auflage/28-s-999-a-111
the image, and Safari rotates it automatically:
https://schoolbook.solutions/images/stories/com_form2content/p1/f19/gallery28/image.jpg
To make a test You can download this file.
Thanks a lot,
Frederic
thanks for Your reply.
Here I give You an example including an imagefile of an iPhone SE
I checked it online with http://metapicz.com
The Mac (OSX) automatically rotates it, but surely not on web pages.
I checked it with an android-phone: no problem because it rotates it when saving the file.
the webpage using F2C:
https://schoolbook.solutions/index.php/18-solution/uni-fh/uni-mathe-walz-mathe-fh-2-auflage/28-s-999-a-111
the image, and Safari rotates it automatically:
https://schoolbook.solutions/images/stories/com_form2content/p1/f19/gallery28/image.jpg
To make a test You can download this file.
Thanks a lot,
Frederic
- more than a month ago
- F2C field types
- # 2
Accepted Answer
Pending Moderation
Hello Frederic,
We have an auto-rotate function in the code already:
When I upload the image on my machine, I see the correct image.
Could it be that the exif function is not enabled on your server? When that's the case, this function produces a log warning and gets skipped.
Best,
Julien
We have an auto-rotate function in the code already:
private function fixRotation($srcFile)
{
$srcProps = JImageF2cExtended::getImageFileProperties($srcFile);
if($srcProps->type != IMG_JPG)
{
// no action required
return false;
}
// Check if the exif_read_data is present
if(!function_exists('exif_read_data'))
{
// we can't perform the rotation fix....
JLog::add('Form2Content: function exif_read_data not present. Can\'t execute fixRotation function.', JLog::WARNING, 'error');
return false;
}
// Suppress warning while reading exif data (Incorrect APP1 Exif Identifier Code)
$exif = @exif_read_data($srcFile);
$rotated = false;
if (isset($exif['Orientation']))
{
$image = new JImageF2cExtended($srcFile);
switch ($exif['Orientation'])
{
case 3:
// Need to rotate 180 deg
$image = $image->rotate(180);
$rotated = true;
break;
case 6:
// Need to rotate 90 deg clockwise
$image = $image->rotate(-90);
$rotated = true;
break;
case 8:
// Need to rotate 90 deg counter clockwise
$image = $image->rotate(90);
$rotated = true;
break;
}
if($rotated)
{
// Store the image (overwrite original file)
$image->toFile($srcFile, $srcProps->type, array('quality' => 100));
}
}
}
When I upload the image on my machine, I see the correct image.
Could it be that the exif function is not enabled on your server? When that's the case, this function produces a log warning and gets skipped.
Best,
Julien
- more than a month ago
- F2C field types
- # 3
Accepted Answer
Pending Moderation
Hi Julien,
I checked everything, but it is still the same.
the EXIF Modul is enabled
here I have the server information: https://schoolbook.solutions/kaka.php
And if I upload an image from my iPhone or iPad it uploads without any interruption
but without turning the picture.
on Your demo server:
https://demo.form2content.com/demo/new-article-form/article/new/
I checked the function and it works so it has to be my server who makes trouble.
Additional now sometimes I upload an image save it and after that it shows a different image, what can be the mistake?
Where can I check my server?
Can it be the contentType or the f2c template?
At the attachment you can see what I did last night to check it,
another thing what You can see, that the symbols are not correct (that is not so important)
Thank You very much,
stay healthy,
Frederic Espitalier
I checked everything, but it is still the same.
the EXIF Modul is enabled
here I have the server information: https://schoolbook.solutions/kaka.php
And if I upload an image from my iPhone or iPad it uploads without any interruption
but without turning the picture.
on Your demo server:
https://demo.form2content.com/demo/new-article-form/article/new/
I checked the function and it works so it has to be my server who makes trouble.
Additional now sometimes I upload an image save it and after that it shows a different image, what can be the mistake?
Where can I check my server?
Can it be the contentType or the f2c template?
At the attachment you can see what I did last night to check it,
another thing what You can see, that the symbols are not correct (that is not so important)
Thank You very much,
stay healthy,
Frederic Espitalier
- more than a month ago
- F2C field types
- # 4
Accepted Answer
Pending Moderation
I found out:
the error only happens when using Field Type "image gallery" (always landscape)
but when using Field Type "Image" the turning of the right image orientation works fine.
so, what now? I would like to use the image gallery type :-(
If I now start with FieldType "image" I will not convert it later.
You can test it here with your iPhone:
https://schoolbook.solutions/index.php?option=com_form2content&view=form&layout=edit&projectid=2&Itemid=270
The same on Your Demo Server, where You can also test, that the cropping in Field Type "image gallery" does not work.
the error only happens when using Field Type "image gallery" (always landscape)
but when using Field Type "Image" the turning of the right image orientation works fine.
so, what now? I would like to use the image gallery type :-(
If I now start with FieldType "image" I will not convert it later.
You can test it here with your iPhone:
https://schoolbook.solutions/index.php?option=com_form2content&view=form&layout=edit&projectid=2&Itemid=270
The same on Your Demo Server, where You can also test, that the cropping in Field Type "image gallery" does not work.
- more than a month ago
- F2C field types
- # 5
Accepted Answer
Pending Moderation
Hi Frederic,
OK, now I see what the problem is: we forgot to include the rotation function in the image gallery field
We have to fix this in the next release. For the meantime, I think there's a quick fix:
Open the file components/com_form2content/controllers/formbase.raw.php
On line #351 you'll see this code:
Just add the following lines right after the "try" statement like this:
Hope this helps!
best,
Julien
OK, now I see what the problem is: we forgot to include the rotation function in the image gallery field
We have to fix this in the next release. For the meantime, I think there's a quick fix:
Open the file components/com_form2content/controllers/formbase.raw.php
On line #351 you'll see this code:
// Move the image to the temp location
JFile::upload($image['tmp_name'], $tmpImage);
try
{
// create thumbnail image
if($thumbnail = $this->createThumbnail($tmpImage))
{
$resultInfo['filename'] = $filename;
$resultInfo['thumbnail'] = $thumbnail;
$resultInfo['cropping'] = $this->field->settings->get('img_cropping', F2C_FIELD_IMAGE_CROP_NOT_ALLOWED);
}
else
{
$resultInfo['error'] = JText::_('COM_FORM2CONTENT_ERROR_IMAGE_RESIZE_FAILED');
}
}
catch(Exception $e)
{
$resultInfo['error'] = $e->getMessage();
}
Just add the following lines right after the "try" statement like this:
// Move the image to the temp location
JFile::upload($image['tmp_name'], $tmpImage);
try
{
// Fix the rotation (issue caused mainly by mobile uploads)
$this->fixRotation($tmpImage);
// create thumbnail image
if($thumbnail = $this->createThumbnail($tmpImage))
{
$resultInfo['filename'] = $filename;
$resultInfo['thumbnail'] = $thumbnail;
$resultInfo['cropping'] = $this->field->settings->get('img_cropping', F2C_FIELD_IMAGE_CROP_NOT_ALLOWED);
}
else
{
$resultInfo['error'] = JText::_('COM_FORM2CONTENT_ERROR_IMAGE_RESIZE_FAILED');
}
}
catch(Exception $e)
{
$resultInfo['error'] = $e->getMessage();
}
Hope this helps!
best,
Julien
- more than a month ago
- F2C field types
- # 6
- Page :
- 1
There are no replies made for this post yet.
However, you are not allowed to reply to this post.
However, you are not allowed to reply to this post.
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »