외부 이미지 썸네일 리스트 갤러리
본문
외부 URL 이미지를 굳이 서버로 복사해 와서 썸네일로 만들어 리스트에 보여주는 스킨입니다.
그누보드5 기본 gallery 스킨에서 썸네일 부분만 일부 수정했습니다.
첨부파일로 업로드한 이미지, 본문에 업로드 해서 넣은 이미지가 없는 경우 본문 작성시 다른 사이트의 이미지를 복사해서 붙여넣은 경우 리스트 페이지에서 해당 이미지를 서버로 복사해 오고 그 복사한 이미지를 썸네일로 만듭니다.
그누보드의 썸네일 함수를 이용했습니다
gallery 스킨의 원래 코드
<?php } else { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); if($thumb['src']) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >'; } else { $img_content = '<span class="no_image">no image</span>'; } echo $img_content; } ?>
수정된 소스
<?php } else { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); if($thumb['src']) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >'; // 외부 이미지 썸네일 만들기 { } else if($url_img = get_editor_image($list[$i]['wr_content'])){ $img_src = $url_img[1][0]; preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img_src, $m); $src = htmlspecialchars_decode($m[1]); preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img_src, $m); $alt = get_text($m[1]); $filename = hash("sha256", $src); $source_path = $target_path = G5_DATA_PATH.'/file/'.$board['bo_table']; $file_download = $target_path."/".$filename; if (!file_exists($file_download)) { copy($src, $file_download); } $thumb_src = thumbnail($filename, $source_path, $target_path, $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); $img_content = '<img src="'.G5_DATA_URL.'/file/'.$board['bo_table'].'/'.$thumb_src.'" alt="'.$alt.'" >'; // } 외부 이미지 썸네일 만들기 } else { $img_content = '<span class="no_image">no image</span>'; } echo $img_content; } ?>
그누보드5 기본 gallery 스킨에서 썸네일 부분만 일부 수정했습니다.
첨부파일로 업로드한 이미지, 본문에 업로드 해서 넣은 이미지가 없는 경우 본문 작성시 다른 사이트의 이미지를 복사해서 붙여넣은 경우 리스트 페이지에서 해당 이미지를 서버로 복사해 오고 그 복사한 이미지를 썸네일로 만듭니다.
그누보드의 썸네일 함수를 이용했습니다
gallery 스킨의 원래 코드
<?php } else { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); if($thumb['src']) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >'; } else { $img_content = '<span class="no_image">no image</span>'; } echo $img_content; } ?>
수정된 소스
<?php } else { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); if($thumb['src']) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >'; // 외부 이미지 썸네일 만들기 { } else if($url_img = get_editor_image($list[$i]['wr_content'])){ $img_src = $url_img[1][0]; preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img_src, $m); $src = htmlspecialchars_decode($m[1]); preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img_src, $m); $alt = get_text($m[1]); $filename = hash("sha256", $src); $source_path = $target_path = G5_DATA_PATH.'/file/'.$board['bo_table']; $file_download = $target_path."/".$filename; if (!file_exists($file_download)) { copy($src, $file_download); } $thumb_src = thumbnail($filename, $source_path, $target_path, $board['bo_gallery_width'], $board['bo_gallery_height'], false, true); $img_content = '<img src="'.G5_DATA_URL.'/file/'.$board['bo_table'].'/'.$thumb_src.'" alt="'.$alt.'" >'; // } 외부 이미지 썸네일 만들기 } else { $img_content = '<span class="no_image">no image</span>'; } echo $img_content; } ?>
댓글목록
등록된 댓글이 없습니다.