최신글에 외부 이미지 썸네일을 나오게 하고 싶은데..

최신글에 외부 이미지 썸네일을 나오게 하고 싶은데..

QA

최신글에 외부 이미지 썸네일을 나오게 하고 싶은데..

답변 1

본문

최신글에 외부 이미지 썸네일을 나오게 하고 싶은데

프로그램이 막히네요.

 

아래 소스를 어찌 해야 할까요?

 

최신글 소스

 


            <a href="<?php echo $list[$i]['href'] ?>" class="gall_img">
                <?php
                    $v = "";
                    $mov_link = "";
                    $img_content = "";
                    $mov_link = $list[$i]['wr_10'];
                    $youtube_url = parse_url($mov_link);
                    parse_str($youtube_url['query']);
                    if($v){
                    $img_content = '<img src="'.get_yt_thumb( 'http://youtu.be/'.$v, 'maxres' ).'" alt="'.$list[$i]['subject'].'" width="'.$thumb_width.'" height="'.$thumb_height.'" />';
                    }
                    
                    if(!$img_content) {
                    $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
                    }                            
                    $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
                    if($thumb['src']) {
                        $img_content = '<span style="width:'.$thumb_width.'px;height:'.$thumb_height.'px"><img src="'.$img.'" alt="'.$thumb['alt'].'" ></span>';
                    }
                        
                    echo $img_content;
                ?>
            </a>

 

아래 소스를 갤러리 게시판에서 제가 외부 이미지 불러오는데 사용했던 소스인데 이 소스를 최신글에 적용 할려고 하는데 막히네요.

 

도움 좀 부탁 드립니다.

 


                <a href="<?php echo $list[$i]['href'] ?>" class="gall_img">
                    <?php
                            $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
                           if($thumb['src']) {
                              $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                                //    외부 이미지 썸네일 만들기 {
                                } 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 = '';
                            }
                            echo $img_content;
                        }
                        {
                        $v_img_count = count($list[$i]['file']);
                            if($v_img_count && !$img_content) { 
                            if ($list[$i]['file'][0]['view']) {
                            echo strip_tags(get_view_thumbnail($list[$i]['file'][0]['view']), '<img>');
                            }
                        }
                    ?>
                </a>

 

 

이 질문에 댓글 쓰기 :

답변 1

능력자님들이 만들어주신 팁이 있으면 모를까

함수를 따로 만들어서 수정하는게 좋지 않을까 싶습니다.

의뢰라고 하기는 좀 그렇지만 글로 설명하는건 .... 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 123,681
© SIRSOFT
현재 페이지 제일 처음으로