$("#bo_v_atc").viewimageresize(); 제외시키기
본문
반응형을 고려해서 $("#bo_v_atc").viewimageresize();가 있습니다.
이로인해 뷰페이지에 있는 이미지들의 속성으로 이미지의 너비값이 들어가게 되는데 이로인해 새로운 css를 적용하는데 불편합니다.
특정 이미지는 이 함수로부터 영향을 받지 않도록 하려면 어떻게 해야 할까요?
답변 1
좀 복잡하실텐데
일단은 해당 값으로 ex_img 를 제외한다고 정의하시고요
$("#bo_v_atc").viewimageresize("img[class!='ex_img']");
글등록할때 제외할 해당 이미지에 class='ex_img' 를 넣어 주십니다
해당 내용 보여주실때 $write[content] 를 사용하시면
이미지의 사이즈를 변경하기때문에 아래내용을 추가로 처리하셔야 합니다
thumbnail.lib.php 에 get_view_thumbnail() 함수 안
preg_match("/height:\s*(\d+)px/", $style, $m);
$height = $m[1];
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img, $m);
$alt = get_text($m[1]);
부분에 아래를 첨부해 주시고
preg_match("/class=[\"\']?([^\"\']*)[\"\']?/", $img, $m);
$class = $m[1];
하단부분에
if ($width) {
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'" />';
} else {
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" alt="'.$alt.'"/>';
}
부분에 class 를 추가해 주셔야 합니다
if ($width) {
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'" class="'.$class.'"/>';
} else {
$thumb_tag = '<img src="'.G5_URL.str_replace($filename, $thumb_file, $data_path).'" alt="'.$alt.'" class="'.$class.'"/>';
}