썸네일 생성시 exif_read_data 함수없을 때 예외처리 추가

This commit is contained in:
chicpro
2013-12-10 09:55:35 +09:00
parent bb5b2d0336
commit ef709c75eb

View File

@ -108,7 +108,7 @@ function get_view_thumbnail($contents, $thumb_width=0)
continue; continue;
// jpg 이면 exif 체크 // jpg 이면 exif 체크
if($size[2] == 2) { if($size[2] == 2 && function_exists('exif_read_data')) {
$degree = 0; $degree = 0;
$exif = @exif_read_data($srcfile); $exif = @exif_read_data($srcfile);
if(!empty($exif['Orientation'])) { if(!empty($exif['Orientation'])) {
@ -218,6 +218,8 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
$src = imagecreatefromgif($source_file); $src = imagecreatefromgif($source_file);
} else if ($size[2] == 2) { } else if ($size[2] == 2) {
$src = imagecreatefromjpeg($source_file); $src = imagecreatefromjpeg($source_file);
if(function_exists('exif_read_data')) {
// exif 정보를 기준으로 회전각도 구함 // exif 정보를 기준으로 회전각도 구함
$exif = @exif_read_data($source_file); $exif = @exif_read_data($source_file);
if(!empty($exif['Orientation'])) { if(!empty($exif['Orientation'])) {
@ -245,6 +247,7 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
} }
} }
} }
}
} else if ($size[2] == 3) { } else if ($size[2] == 3) {
$src = imagecreatefrompng($source_file); $src = imagecreatefrompng($source_file);
} else { } else {