R

이미지 리사이즈 jQuery 로 변경 방법

board.js 파일에 아래 항목을 추가 해주세요.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jQuery.resimg = function(element, options){
    var setting = { imageWidth:600, borderColor:false }
    $.extend(setting, options);

    var imageWidth = setting.imageWidth;
    var borderColor = setting.borderColor;


    $(element).each(function(){
var img_width = $(this).outerWidth();
    var img_height = $(this).outerHeight();

//원래 사이즈를 저장한다.
    $(this).attr("tmp_width", img_width);
    $(this).attr("tmp_height", img_height);

    // 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
    if(img_width > imageWidth) {
        imageHeight = parseFloat(img_width/ img_height);
        $(this).width(imageWidth).height(parseInt(imageWidth / imageHeight)).css("cursor", "pointer");
//$(this).width(imageWidth).css("cursor", "pointer");
    }

    if (borderColor) $(this).css({ "border" : "1px solid "+ borderColor });
});
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

그리고 view스킨 파일 최하단스크립트를 아래와 같이 수정하세요.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//제이쿼리 임포트
<script language="JavaScript" src="<?="$g4[path]/js/jquery-latest.js"></script>
<script language="JavaScript" src="<?="$g4[path]/js/board.js"?>"></script>
<script language="JavaScript">
$(document).ready(function(){
    $.resimg("img[name='target_resize_image[]']", {imageWidth:<?=(int)$board[bo_image_width]?>});
//resizeBoardImage(<?=(int)$board[bo_image_width]?>);
    drawFont();
});
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[이 게시물은 관리자님에 의해 2011-10-31 16:55:28 jQuery에서 이동 됨]
|

댓글 1개

파폭에서 이미지 팝업 띄울시 에러가 있어 약간의 코드를 수정했습니다.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jQuery.resimg = function(element, options){
var setting = { imageWidth:600, borderColor:false }
$.extend(setting, options);

var imageWidth = setting.imageWidth;
var borderColor = setting.borderColor;

//alert($(element).children().get().length);
$(element).each(function(){
var img_width = $(this).outerWidth();
var img_height = $(this).outerHeight();

//원래 사이즈를 저장한다.
//$(this).attr("tmp_width", img_width);
//$(this).attr("tmp_height", img_height);
var i = $(element).index($(this));
$(element)[i].tmp_width = img_width;
$(element)[i].tmp_height = img_height;

// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(img_width > imageWidth) {
imageHeight = parseFloat(img_width/ img_height);
$(this).width(imageWidth).height(parseInt(imageWidth / imageHeight)).css("cursor", "pointer");
//$(this).width(imageWidth).css("cursor", "pointer");
}

if (borderColor) $(this).css({ "border" : "1px solid "+ borderColor });
});
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
16년 전 조회 1,044
16년 전 조회 2,003
16년 전 조회 1,971
16년 전 조회 1,504
16년 전 조회 2,031
16년 전 조회 2,269
16년 전 조회 1,384
16년 전 조회 1,724
16년 전 조회 1,918
16년 전 조회 1,004
16년 전 조회 1,686
16년 전 조회 1,402
16년 전 조회 1,902
16년 전 조회 1,319
16년 전 조회 2,201
16년 전 조회 1,885
16년 전 조회 5,865
16년 전 조회 1,912
16년 전 조회 3,677
16년 전 조회 1,462
16년 전 조회 1,751
16년 전 조회 2,066
16년 전 조회 2,603
16년 전 조회 2,305
16년 전 조회 2,746
16년 전 조회 2,983
16년 전 조회 3,011
16년 전 조회 1,817
16년 전 조회 1,536
16년 전 조회 1,409
16년 전 조회 1,720
16년 전 조회 1,203
16년 전 조회 1,959
16년 전 조회 1,730
16년 전 조회 1,607
16년 전 조회 1,295
16년 전 조회 2,167
16년 전 조회 3,227
16년 전 조회 2,163
16년 전 조회 1,736
16년 전 조회 1,504
16년 전 조회 2,038
16년 전 조회 4,724
16년 전 조회 1,412
17년 전 조회 2,147
17년 전 조회 2,131
17년 전 조회 2,398
17년 전 조회 2,144
17년 전 조회 4,428
17년 전 조회 2,928
17년 전 조회 2,862
17년 전 조회 1,595
17년 전 조회 1,234
17년 전 조회 3,940
17년 전 조회 1,613
17년 전 조회 1,605
17년 전 조회 2,106
17년 전 조회 1,878
17년 전 조회 1,492
17년 전 조회 3,914
17년 전 조회 1,752
17년 전 조회 3,126
17년 전 조회 3,005
17년 전 조회 1,035
17년 전 조회 1,846
17년 전 조회 1,586
17년 전 조회 1,850
17년 전 조회 2,636
17년 전 조회 3,021
17년 전 조회 3,215
17년 전 조회 3,321
17년 전 조회 1,458
17년 전 조회 1,416
17년 전 조회 2,248
17년 전 조회 1,971
17년 전 조회 2,287
17년 전 조회 2,813
17년 전 조회 3,261
17년 전 조회 2,361
17년 전 조회 1,629
17년 전 조회 3,202
17년 전 조회 3,069
17년 전 조회 3,043
17년 전 조회 3,913
17년 전 조회 2,584
17년 전 조회 2,404
17년 전 조회 2,653
17년 전 조회 2,894
17년 전 조회 2,608
17년 전 조회 1,449
17년 전 조회 1,894
17년 전 조회 1,486
17년 전 조회 1,909
17년 전 조회 2,508
17년 전 조회 8,693
17년 전 조회 3,151
17년 전 조회 4,241
17년 전 조회 1,981
17년 전 조회 3,656
17년 전 조회 1,551
🐛 버그신고