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,973
16년 전 조회 1,504
16년 전 조회 2,032
16년 전 조회 2,269
16년 전 조회 1,385
16년 전 조회 1,725
16년 전 조회 1,919
16년 전 조회 1,006
16년 전 조회 1,686
16년 전 조회 1,404
16년 전 조회 1,902
16년 전 조회 1,320
16년 전 조회 2,201
16년 전 조회 1,885
16년 전 조회 5,867
16년 전 조회 1,912
16년 전 조회 3,678
16년 전 조회 1,465
16년 전 조회 1,751
16년 전 조회 2,068
16년 전 조회 2,604
16년 전 조회 2,306
16년 전 조회 2,747
16년 전 조회 2,983
16년 전 조회 3,011
16년 전 조회 1,818
16년 전 조회 1,537
16년 전 조회 1,411
16년 전 조회 1,722
16년 전 조회 1,204
16년 전 조회 1,962
16년 전 조회 1,730
16년 전 조회 1,609
16년 전 조회 1,295
16년 전 조회 2,167
16년 전 조회 3,228
16년 전 조회 2,163
16년 전 조회 1,737
16년 전 조회 1,506
16년 전 조회 2,039
16년 전 조회 4,724
16년 전 조회 1,413
17년 전 조회 2,147
17년 전 조회 2,132
17년 전 조회 2,401
17년 전 조회 2,147
17년 전 조회 4,429
17년 전 조회 2,929
17년 전 조회 2,864
17년 전 조회 1,597
17년 전 조회 1,238
17년 전 조회 3,942
17년 전 조회 1,614
17년 전 조회 1,609
17년 전 조회 2,107
17년 전 조회 1,879
17년 전 조회 1,494
17년 전 조회 3,917
17년 전 조회 1,752
17년 전 조회 3,129
17년 전 조회 3,008
17년 전 조회 1,037
17년 전 조회 1,846
17년 전 조회 1,589
17년 전 조회 1,850
17년 전 조회 2,636
17년 전 조회 3,022
17년 전 조회 3,215
17년 전 조회 3,322
17년 전 조회 1,460
17년 전 조회 1,416
17년 전 조회 2,250
17년 전 조회 1,972
17년 전 조회 2,288
17년 전 조회 2,813
17년 전 조회 3,261
17년 전 조회 2,362
17년 전 조회 1,630
17년 전 조회 3,203
17년 전 조회 3,070
17년 전 조회 3,044
17년 전 조회 3,914
17년 전 조회 2,584
17년 전 조회 2,404
17년 전 조회 2,654
17년 전 조회 2,894
17년 전 조회 2,610
17년 전 조회 1,451
17년 전 조회 1,895
17년 전 조회 1,487
17년 전 조회 1,910
17년 전 조회 2,509
17년 전 조회 8,693
17년 전 조회 3,152
17년 전 조회 4,241
17년 전 조회 1,981
17년 전 조회 3,658
17년 전 조회 1,551
🐛 버그신고