Page 2 of 2

Re: Some images rotate, why?

Posted: 12 May 2016, 18:24
by Jan
Hi, I will try to implement it in next version. The code you have set, includes some problematic parts:

1) it does not check for mimetype and tries to get information from images which do not have exif data
2) there is no handling for orientation in some cases (e.g. 1)

For now the code which prevents from some error looks like, if you use the code added above, please try to correct it so you will not get any errors:

Code: Select all

list($w, $h, $type) = GetImageSize($fileIn);
// Read EXIF data from image file to get the Orientation flag
			$exif = null;
			if (function_exists('exif_read_data') && $type == IMAGETYPE_JPEG ) {
				$exif = @exif_read_data($fileIn);
			}
			// GetImageSize returns an array of width, height, IMAGETYPE, "height=x width=x" (string)
			// The EXIF Orientation flag is examined to determine if width and height need to be swapped, i.e. if the image will be rotated in a subsequent step
			if(isset($exif['Orientation']) && !empty($exif['Orientation'])) {
				
				switch($exif['Orientation']) {
				   case 8: // will need to be rotated 90 degrees left, so swap order of width and height
					  list($h, $w, $type) = GetImageSize($fileIn);
					  break;
				   case 3: // will need to be rotated 180 degrees so don't swap order of width and height
					  list($w, $h, $type) = GetImageSize($fileIn);
					  break;
				   case 6:   // will need to be rotated 90 degrees right, so swap order of width and height
					  list($h, $w, $type) = GetImageSize($fileIn);
					  break;
				}
			}
The first row should be not removed. E.g. in case you get orientation = 1, then the list will be not done so it must be done as default and in case, there can be used exif orientation, it will be overwritten.

Exif_read_data should be used only for images which use exif.

Jan

Re: Some images rotate, why?

Posted: 16 May 2016, 15:03
by Jan
Hi, set in version 4.3.0

Jan

Re: Some images rotate, why?

Posted: 29 Jun 2016, 23:20
by greg123
Same problem. I think I may have found why images rotate when we do not want them to.

Under Control Panel / Info the function
Function imageRotate is set to Green Check no matter what you set under options. So I have EXIF Rotate set to No or Yes, but under Info it always shows green / enabled.

It is really frustrating. I upload perfectly good images and they rotate various numbers of degrees. I have to rotate them in Control Panel all kinds of ways so they display correctly on my web page.

Re: Some images rotate, why?

Posted: 05 Jul 2016, 01:25
by Jan
Hi, in info, there is no information about if the image will be rotated or not. There is info if there is php function "imagerotated" enabled on your server.

As default "exif rotate" parameter is set to NO and in such case the images are not rotated when thumbnails creation is active. Did you check the "exif rotate" parameter in Options? Did the "No" value really stored in Options?

Jan

Re: Some images rotate, why?

Posted: 02 Jan 2017, 00:08
by Nils
Hi,
Is there a solution to this issue?
I have just installed Phoca Gallery and quite a few of my pictures are rotated 90 degrees. I am sure they had the correct orientation when I uploaded them(double checked both locally and on server).
I know it is possible to rotate them in backend > images but it doesnt always seem to stick/update the frontend. Another strange thing is that sometimes the big thumbnail(detailed) is rotated correctly by means of the rotate button but not the small. Example: https://drive.google.com/open?id=0B8jYX ... GhyTjZ1enM

I use latest release of joomla and Phoca gallery and haven't modified the software in any way.

Its very frustrating.

brgds

Re: Some images rotate, why?

Posted: 02 Jan 2017, 14:56
by Benno
Hi,
have you checked the 'Exif Rotate' parameter from which Jan has spoken in the previous post?

Kind regards,
Benno

Re: Some images rotate, why?

Posted: 02 Jan 2017, 23:16
by Nils
Hi,
Strangely enough today all images have correct orientation. Even the ones I wasn't able to rotate yesterday.
i will upload another batch and see what happens. "Exif rotate" is set to "No".

brgds

Re: Some images rotate, why?

Posted: 03 Jan 2017, 02:01
by Benno
Hi,
Strangely enough today all images have correct orientation. Even the ones I wasn't able to rotate yesterday.
Did you clear all caches (Browser and Joomla!)?

Kind regards,
Benno