답변 2개
채택된 답변
+20 포인트
10년 전
lib/thumbnail.lib.php 75라인 정도에 있는
하단 소스에서 이미지 alt값 자체를 삭제 처리 하면 됩니다.
if ($width) {
$thumb_tag = 'alt="'.$alt.'" width="'.$width.'" height="'.$height.'"/>';
} else {
$thumb_tag = 'alt="'.$alt.'"/>';
}
이 부분에 alt값 삭제 / 하단 소스에서 093 ~ 097 라인
</p><p>// 게시글보기 썸네일 생성</p><p>function get_view_thumbnail($contents, $thumb_width=0)</p><p>{</p><p> global $board, $config;</p><p> </p><p> if (!$thumb_width)</p><p> $thumb_width = $board['bo_image_width'];</p><p> </p><p> // $contents 중 img 태그 추출</p><p> $matches = get_editor_image($contents, true);</p><p> </p><p> if(empty($matches))</p><p> return $contents;</p><p> </p><p> for($i=0; $i<count($matches[1]); $i++) {</p><p> </p><p> $img = $matches[1][$i];</p><p> preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m);</p><p> $src = $m[1];</p><p> preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m);</p><p> $style = $m[1];</p><p> preg_match("/width:\s*(\d+)px/", $style, $m);</p><p> $width = $m[1];</p><p> preg_match("/height:\s*(\d+)px/", $style, $m);</p><p> $height = $m[1];</p><p> preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img, $m);</p><p> $alt = get_text($m[1]);</p><p> </p><p> // 이미지 path 구함</p><p> $p = parse_url($src);</p><p> if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)</p><p> $data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);</p><p> else</p><p> $data_path = $p['path'];</p><p> </p><p> $srcfile = G5_PATH.$data_path;</p><p> </p><p> if(is_file($srcfile)) {</p><p> $size = @getimagesize($srcfile);</p><p> if(empty($size))</p><p> continue;</p><p> </p><p> // jpg 이면 exif 체크</p><p> if($size[2] == 2 && function_exists('exif_read_data')) {</p><p> $degree = 0;</p><p> $exif = @exif_read_data($srcfile);</p><p> if(!empty($exif['Orientation'])) {</p><p> switch($exif['Orientation']) {</p><p> case 8:</p><p> $degree = 90;</p><p> break;</p><p> case 3:</p><p> $degree = 180;</p><p> break;</p><p> case 6:</p><p> $degree = -90;</p><p> break;</p><p> }</p><p> </p><p> // 세로사진의 경우 가로, 세로 값 바꿈</p><p> if($degree == 90 || $degree == -90) {</p><p> $tmp = $size;</p><p> $size[0] = $tmp[1];</p><p> $size[1] = $tmp[0];</p><p> }</p><p> }</p><p> }</p><p> </p><p> // 원본 width가 thumb_width보다 작다면</p><p> if($size[0] <= $thumb_width)</p><p> continue;</p><p> </p><p> // Animated GIF 체크</p><p> $is_animated = false;</p><p> if($size[2] == 1) {</p><p> $is_animated = is_animated_gif($srcfile);</p><p> }</p><p> </p><p> // 썸네일 높이</p><p> $thumb_height = round(($thumb_width * $size[1]) / $size[0]);</p><p> $filename = basename($srcfile);</p><p> $filepath = dirname($srcfile);</p><p> </p><p> // 썸네일 생성</p><p> if(!$is_animated)</p><p> $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);</p><p> else</p><p> $thumb_file = $filename;</p><p> </p><p> if(!$thumb_file)</p><p> continue;</p><p> </p><p> if ($width) {</p><p> $thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" <b>alt="'.$alt.'"</b> width="'.$width.'" height="'.$height.'"/>';</p><p> } else {</p><p> $thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" <b>alt="'.$alt.'"</b>/>';</p><p> }</p><p> </p><p> // $img_tag에 editor 경로가 있으면 원본보기 링크 추가</p><p> $img_tag = $matches[0][$i];</p><p> if(strpos($img_tag, G5_DATA_DIR.'/'.G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {</p><p> $imgurl = str_replace(G5_URL, "", $src);</p><p> $thumb_tag = '<a href="'.G5_BBS_URL.'/view_image.php?fn='.urlencode($imgurl).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';</p><p> }</p><p> </p><p> $contents = str_replace($img_tag, $thumb_tag, $contents);</p><p> }</p><p> }</p><p> </p><p> return $contents;</p><p>}</p><p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인