이미지 리사이즈시 높이값이 있을 경우에 대한 코드 추가
This commit is contained in:
@ -279,17 +279,24 @@ function view_image_resize()
|
|||||||
|
|
||||||
$img.each(function() {
|
$img.each(function() {
|
||||||
var img_width = $(this).width();
|
var img_width = $(this).width();
|
||||||
|
var img_height = $(this).height();
|
||||||
var this_width = $(this).data("width");
|
var this_width = $(this).data("width");
|
||||||
|
var this_height = $(this).data("height");
|
||||||
|
|
||||||
if(this_width == undefined) {
|
if(this_width == undefined) {
|
||||||
$(this).data("width", img_width); // 원래 이미지 사이즈
|
$(this).data("width", img_width); // 원래 이미지 사이즈
|
||||||
|
$(this).data("height", img_height);
|
||||||
this_width = img_width;
|
this_width = img_width;
|
||||||
|
this_height = img_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this_width > res_width) {
|
if(this_width > res_width) {
|
||||||
$(this).width(res_width);
|
$(this).width(res_width);
|
||||||
|
var res_height = Math.round(res_width * $(this).data("height") / $(this).data("width"));
|
||||||
|
$(this).height(res_height);
|
||||||
} else {
|
} else {
|
||||||
$(this).width(this_width);
|
$(this).width(this_width);
|
||||||
|
$(this).height(this_height);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -277,17 +277,24 @@ function view_image_resize()
|
|||||||
|
|
||||||
$img.each(function() {
|
$img.each(function() {
|
||||||
var img_width = $(this).width();
|
var img_width = $(this).width();
|
||||||
|
var img_height = $(this).height();
|
||||||
var this_width = $(this).data("width");
|
var this_width = $(this).data("width");
|
||||||
|
var this_height = $(this).data("height");
|
||||||
|
|
||||||
if(this_width == undefined) {
|
if(this_width == undefined) {
|
||||||
$(this).data("width", img_width); // 원래 이미지 사이즈
|
$(this).data("width", img_width); // 원래 이미지 사이즈
|
||||||
|
$(this).data("height", img_height);
|
||||||
this_width = img_width;
|
this_width = img_width;
|
||||||
|
this_height = img_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this_width > res_width) {
|
if(this_width > res_width) {
|
||||||
$(this).width(res_width);
|
$(this).width(res_width);
|
||||||
|
var res_height = Math.round(res_width * $(this).data("height") / $(this).data("width"));
|
||||||
|
$(this).height(res_height);
|
||||||
} else {
|
} else {
|
||||||
$(this).width(this_width);
|
$(this).width(this_width);
|
||||||
|
$(this).height(this_height);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user