그누보드, 본문 내용에 이미지맵 태그 사용 htmlpurifier usemap, Image map > php

본문 바로가기
사이트 내 전체검색

php

그누보드, 본문 내용에 이미지맵 태그 사용 htmlpurifier usemap, Image map

페이지 정보

작성자 서방님 댓글 0건 조회 74회 작성일 23-06-20 10:08

본문

그누보드 게시판 본문 내용은 htmlpurifier 플러그인이 적용되어 있습니다.

그래서 이미지맵 태그는 작동하지 않는데 사용할 수 있게 수정하는 방법입니다.



수정 파일 : lib/common.lib.php



아래 함수를 찾은 후


function html_purifier($html)
{

...............................

...............................

    $config->set('Attr.AllowedFrameTargets', array('_blank'));
    //유튜브, 비메오 전체화면 가능하게 하기
    $config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));

..............................


여기 바로 아래쯤에 다음 코드 전체 추가.



    $def = $config->getHTMLDefinition(true);
    // Add usemap attribute to img tag
    $def->addAttribute('img', 'usemap', 'CDATA');

    // Add map tag
    $map = $def->addElement(
        'map', // name
        'Block', // content set
        'Flow', // allowed children
        'Common', // attribute collection
        array(// attributes
            'name' => 'CDATA',
            'id' => 'ID',
            'title' => 'CDATA',
        )
    );
    $map->excludes = array('map' => true);

    // Add area tag
    $area = $def->addElement(
        'area', // name
        'Block', // content set
        'Empty', // don't allow children
        'Common', // attribute collection
        array(// attributes
            'name' => 'CDATA',
            'id' => 'ID',
            'alt' => 'Text',
            'coords' => 'CDATA',
            'accesskey' => 'Character',
            'nohref' => new HTMLPurifier_AttrDef_Enum(array('nohref')),
            'href' => 'URI',
            'shape' => new HTMLPurifier_AttrDef_Enum(array('rect', 'circle', 'poly', 'default')),
            'tabindex' => 'Number',
            'target' => new HTMLPurifier_AttrDef_Enum(array('_blank', '_self', '_target', '_top'))
        )
    );
    $area->excludes = array('area' => true);




## 위치 참고 ##


9ad408622658847006e4b9cceb093f17_1687223277_1357.png
 



모바일 페이지 또는 반응형 사이트에 이미지 크기가 고정 사이즈가 아닌 %로 지정되어 있다면 추가 수정이 필요합니다.

Image Map Resize 를 위 팁과 같이 적용해봤는데 게시판 본문 이미지맵에서도 정상적으로 작동하네요.

http://gnustudy.com/bbs/board.php?bo_table=sitelink&wr_id=35 


Image Map Resize 적용 방법
http://gnustudy.com/bbs/board.php?bo_table=skin_board&wr_id=201




출처 : https://sir.kr/g5_tip/3099

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
5
어제
58
최대
1,347
전체
153,769
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.