mobileex 에서만 되는 방법만 있어,
제가 한 방법을 적어봅니다.
저는 imageprocess module 에 image rotate 기능을 추가해서, 이미지 압축 처리할때, image orientation 정보를 이용해서
자동으로 회전하는 부분을 처리하였습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | if($file){ if($ext == "jpg" || $ext == "jpeg"){ $image = imagecreatefromjpeg($file); }else if($ext == "png"){ $image = imagecreatefrompng($file); } else if($ext == "bmp" || $ext == "wbmp"){ $image = imagecreatefromwbmp($file); }else if($ext == "gif"){ $image = imagecreatefromgif($file); } $exif = exif_read_data($file); if(!empty($exif['Orientation'])) { switch($exif['Orientation']) { case 8: $image = imagerotate($image,270,0); break; case 3: $image = imagerotate($image,180,0); break; case 6: $image = imagerotate($image,-90,0); break; } if($ext == "jpg" || $ext == "jpeg"){ imagejpeg($image,$file); } else if($ext == "png"){ imagepng($image,$file); }else if($ext == "bmp" || $ext == "wbmp"){ imagewbmp($image,$file); }else if($ext == "gif"){ imagegif($image,$file); } } } |
위에 코드를 imageprocess.controller.php 파일에
$ext = strtolower(substr(strrchr($args->source_filename,'.'),1));
소스 다음에 추가하시면, image orientation 되어 있는 파일이 자동으로 회전되어 올라가게 됩니다.
테스트 mobile 은 갤럭시s3, g2 기종으로 찍은 사진으로 해봤네요..
imageprocess module 설치되어 있으면, 기존 xe board 에서 pc / mobile 지원이 됩니다.
'웹문서 공부' 카테고리의 다른 글
댓글 수정할 때 태그 비노출 시키는 태그 (0) | 2017.11.21 |
---|---|
ssl 적용 후 http-https리디렉션 (0) | 2017.11.12 |
mysql에서 특정 문자열을 포함한 내용 검색 (0) | 2015.07.30 |
[XE]닉네임 변경 (0) | 2015.04.29 |
입력한 텍스트 url로 이동 (0) | 2015.04.22 |