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,043
16년 전 조회 2,002
16년 전 조회 1,970
16년 전 조회 1,503
16년 전 조회 2,030
16년 전 조회 2,268
16년 전 조회 1,384
16년 전 조회 1,723
16년 전 조회 1,915
16년 전 조회 1,000
16년 전 조회 1,684
16년 전 조회 1,401
16년 전 조회 1,902
16년 전 조회 1,317
16년 전 조회 2,200
16년 전 조회 1,885
16년 전 조회 5,864
16년 전 조회 1,911
16년 전 조회 3,677
16년 전 조회 1,461
16년 전 조회 1,750
16년 전 조회 2,065
16년 전 조회 2,603
16년 전 조회 2,303
16년 전 조회 2,746
16년 전 조회 2,983
16년 전 조회 3,010
16년 전 조회 1,815
16년 전 조회 1,535
16년 전 조회 1,407
16년 전 조회 1,719
16년 전 조회 1,203
16년 전 조회 1,959
16년 전 조회 1,730
16년 전 조회 1,606
16년 전 조회 1,293
16년 전 조회 2,166
16년 전 조회 3,226
16년 전 조회 2,163
16년 전 조회 1,736
16년 전 조회 1,504
16년 전 조회 2,037
16년 전 조회 4,724
16년 전 조회 1,411
17년 전 조회 2,145
17년 전 조회 2,129
17년 전 조회 2,395
17년 전 조회 2,142
17년 전 조회 4,428
17년 전 조회 2,924
17년 전 조회 2,860
17년 전 조회 1,595
17년 전 조회 1,233
17년 전 조회 3,939
17년 전 조회 1,613
17년 전 조회 1,604
17년 전 조회 2,106
17년 전 조회 1,876
17년 전 조회 1,491
17년 전 조회 3,913
17년 전 조회 1,752
17년 전 조회 3,125
17년 전 조회 3,004
17년 전 조회 1,034
17년 전 조회 1,843
17년 전 조회 1,586
17년 전 조회 1,847
17년 전 조회 2,635
17년 전 조회 3,020
17년 전 조회 3,213
17년 전 조회 3,321
17년 전 조회 1,456
17년 전 조회 1,414
17년 전 조회 2,248
17년 전 조회 1,971
17년 전 조회 2,286
17년 전 조회 2,809
17년 전 조회 3,260
17년 전 조회 2,361
17년 전 조회 1,629
17년 전 조회 3,202
17년 전 조회 3,067
17년 전 조회 3,041
17년 전 조회 3,910
17년 전 조회 2,583
17년 전 조회 2,403
17년 전 조회 2,652
17년 전 조회 2,893
17년 전 조회 2,608
17년 전 조회 1,449
17년 전 조회 1,893
17년 전 조회 1,485
17년 전 조회 1,909
17년 전 조회 2,508
17년 전 조회 8,691
17년 전 조회 3,151
17년 전 조회 4,238
17년 전 조회 1,980
17년 전 조회 3,656
17년 전 조회 1,551
🐛 버그신고