$img_tag에 editor 경로가 있으면 원본보기 링크 추가
본문
// 썸네일 생성
if(!$is_animated)
$thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);
else
$thumb_file = $filename;
if(!$thumb_file)
continue;
if ($width) {
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"/>';
} else {
$imgurl = $src;
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" class="view_image" alt="'.$alt.'"/>'; //이미지 자체
}
// $img_tag에 editor 경로가 있으면 원본보기 링크 추가
$img_tag = $matches[0][$i];
if(strpos($img_tag, G5_DATA_DIR.'/'.G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {
$imgurl = str_replace(G5_URL, "", $src);
$thumb_tag = '<a href="'.G5_BBS_URL.'/view_image.php?fn='.urlencode($imgurl).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
}
$contents = str_replace($img_tag, $thumb_tag, $contents);
코드가 이렇게 되어 있던데요...
이와 반대의 경우에도
// $img_tag에 editor 경로가 없어도 원본보기 링크 추가
하려면 어떻게 하면 될까요?
답변 1
에디터에 있는 사진 찾기 기능을 이용해서 추가한 경우에
data 폴더에 업로드가 되며, 이를 연결해서 원본보기 링크가 뜨는겁니다.
그 외에 이미지에 링크를 하시겠다는 건데,
우선 원본이 외부에 있으면 그냥 아래 태그로 연결하는 방법이 있습니다.
<a href="이미지경로" target="_blank">이미지경로</a>