diff --git a/bbs/view_image.php b/bbs/view_image.php index c7a7edca7..f988deeb5 100644 --- a/bbs/view_image.php +++ b/bbs/view_image.php @@ -23,57 +23,87 @@ if(strpos($filename, G5_DATA_DIR.'/editor')) { $filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$filename; } -if(is_file($filepath)) { - $size = @getimagesize($filepath); +$file_exists = (is_file($filepath) && file_exists($filepath)) ? 1 : 0; + +if(run_replace('exists_view_image', $file_exists, $filepath, $editor_file)) { + $size = $file_exists ? run_replace('get_view_imagesize', @getimagesize($filepath), $filepath, $editor_file) : array(); if(empty($size)) alert_close('이미지 파일이 아닙니다.'); - $width = $size[0]; - $height = $size[1]; + $width = (isset($size[0]) && $size[0]) ? (int) $size[0] : 0; + $height = (isset($size[1]) && $size[1]) ? (int) $size[1] : 0; if($editor_file) $fileurl = G5_DATA_URL.'/'.$editor_file; else $fileurl = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename; - $img = ''; + $img_attr = ($width && $height) ? 'width="'.$width.'" height="'.$height.'"' : ''; + + $img = ''; } else { alert_close('파일이 존재하지 않습니다.'); } ?> -
+