채택완료

도저히 못찾겠네요,,,

2016-10-26 (수) 10:56:36 5,216

안녕하세요,,저급 짜집퍼 민쯩까입니다.

에디터로 댓글에 이미지 첨부되게 하였습니다.

뷰페이지 댓글 부분에 잘 나오는데요,,,

이 이미지를 클릭시 새창으로 띄우고자 하는데...

소스의 어느부분을 어떻게 고쳐야 하는지 모르겠습니다.

도움이 필요합니다.

뷰코멘트 스킨에는 이런데요..아무리 봐도 관련 부분이 없는거 같아서,,,

<!-- 댓글 출력 -->

                <div  class='comment_view' style='line-height:20px; padding:7px 15px; word-break:break-all; overflow:hidden; clear:both; '>

            <?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>

<?php echo url_auto_link($list[$i]['wr_content']); //$comment ?>  

                </div>

<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>

                <span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->

                <span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 -->

        <input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">

        <textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>

        <?php if($list[$i]['is_reply'] || $list[$i]['is_edit'] || $list[$i]['is_del']) {

            $query_string = clean_query_string($_SERVER['QUERY_STRING']);

            if($w == 'cu') {

                $sql = " select wr_id, wr_content, mb_id from $write_table where wr_id = '$c_id' and wr_is_comment = '1' ";

                $cmt = sql_fetch($sql);

                if (!($is_admin || ($member['mb_id'] == $cmt['mb_id'] && $cmt['mb_id'])))

                    $cmt['wr_content'] = '';

                $c_wr_content = $cmt['wr_content'];

            }

            $c_reply_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=c#comment_write';

            $c_edit_href = './board.php?'.$query_string.'&amp;c_id='.$comment_id.'&amp;w=cu#bcomment_write';

         ?>

        <footer>

            <ul class="bo_vc_act">

            </ul>

        </footer>

        <?php } ?>

    </article>

    <?php } ?>

    <?php if ($i == 0) { //댓글이 없다면 ?><p id="bo_vc_empty">등록된 댓글이 없습니다.</p><?php } ?>

</section>

<!-- } 댓글 끝 -->

|

답변 1개 / 댓글 2개

채택된 답변
+20 포인트

<?php echo url_auto_link($list[$i]['wr_content']); //$comment ?>   

이부분에 들어 있습니다.

에디터로 작성한것은 첨부파일이 아니기때문이 이미 img src 테그로 조합되어 뿌려지겠죠..


$list[$i]['wr_content']=str_replace("<img","<img class='click_img'",$list[$i]['wr_content']);

이렇게 코멘트 본문의 img 테그에 click_img 라는 클래스를 강제로 달아버립니다.

물론 본문이 출력되기전에 들어가야 되는 코드 입니다.

만약 기존의 본문이미지에 이미 클래스가 설정되어있다면  정규식으로 치환해도 됩니다.


적당한 스타일에다가

.click_img{cursor:pointer;} 

추가해줍니다. 이미지 마우스 오버시 손꾸락 모양으로 바뀌게..


그리고 적당한 스크립트를 작성해줍니다.


<script>

$(document).ready(function() {

//click_img 클래스가 클릭되면

$('.click_img').click(function() {

//해당 이미지 경로를 img_url 에 담습니다.

var img_url = $(this).attr("src");

//새창으로 해당 이미지 url을 띄웁니다.

window.open(img_url);

}); 

}); 

</script>


적당한 위치에 적당히 넣어놓으면 안될리가 없는 스크립트 입니다.

답변에 대한 댓글 2개

2016-10-26 (수) 13:17:20
와,,친절한 설명감사합니다~ 해볼게요..
2016-10-26 (수) 13:23:27
님의 실력은 예전부터 알고 있었지만,..
어떻게 이런거 까지 알고 계신지..존경스럽습니다.
한방에 해결되네요,,,
오늘 엮일뻔 한거 구해주셨어요,,으헝,,
감사합니다.

답변을 작성하려면 로그인이 필요합니다.