Inconsistent image orientation correction in php for android 4.1.2 -


when trying fix image orientation in php after uploading image android using popular code:

http://snipplr.com/view/76539/:

function image_fix_orientation($path){  	$image = imagecreatefromjpeg($path);  	$exif = exif_read_data($path);     	if (!empty($exif['orientation'])) {  		switch ($exif['orientation']) {  			case 3:  				$image = imagerotate($image, 180, 0);  				break;  			case 6:  				$image = imagerotate($image, -90, 0);  				break;  			case 8:  				$image = imagerotate($image, 90, 0);  				break;  		}  		imagejpeg($image, $path);  	}  }

and works android 2.

we have inconsistent behaviour android 4.1.2. code not correct images taken android 4.1.2..

but code does:

        function image_fix_orientation($path){      	$image = imagecreatefromjpeg($path);      	//$exif = exif_read_data($path);             	//if (!empty($exif['orientation'])) {      	//	switch ($exif['orientation']) {      	//		case 3:      	//			$image = imagerotate($image, 180, 0);      	//			break;      	//		case 6:      	//			$image = imagerotate($image, -90, 0);      	//			break;      	//		case 8:      	//			$image = imagerotate($image, 90, 0);      	//			break;      	//	}      		imagejpeg($image, $path);      	}      }

for version seems no imagerotate() nessesary.. createimagefromjpeg() > imagejpeg().

is there solution? or should change code version??? know why happening?

please help, doron


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -