/*
* version : 1
* var img = new ImageResizer("img", "/img/temp.gif", "viewImg", 200, 200);
* img.imgChecker();
*
* var [인스턴스명] = new StaticMenu("[인스턴스명]", [원본 image Url], [Html Tag로 선언된 보여질 IMG의 ID], [최대 가로길이], [최대 세로길이]);
*
* 모든항목 필수
* instanceName : 선언된 instance의 이름 : timer 지정시 대상 object 선별에 사용
* srcUrl : 원본 image의 URL
* displySrc : 보여질 Image Tag의 ID
* maxWidth : 제한되어질 최대 가로길이
* maxHeight : 제한되어질 최대 세로길이
*
*
* var imgList = new Array();
* imgList[imgList.length] = new ImageResizer("imgList["+imgList.length+"]", "/img/temp.gif", "viewImg"+imgList.length, 200, 200);
* imgList[imgList.length-1].imgChecker();
* imgList[imgList.length] = new ImageResizer("imgList["+imgList.length+"]", "/img/temp.gif", "viewImg"+imgList.length, 200, 200);
* imgList[imgList.length-1].imgChecker();
* 위와 같이 배열에 담겨질 경우에 instanceName을 위와 같이 선언한다.
*/
function ImageResizer(instanceName, srcUrl, displySrc, maxWidth, maxHeight){
this.thisInstanceName = instanceName;
this.img = new Image();
this.img.src = srcUrl;
this.displySrc = displySrc;
this.maxWidth = maxWidth;
this.maxHeight = maxHeight;
this.imgChecker = function (){
if(this.img!=null && this.img.complete == true && this.displySrc!=null){
var originalImg = this.img;
var targetImg = document.getElementById(this.displySrc);
if(originalImg.width > originalImg.height){
if(eval(originalImg.width>this.maxWidth)){
originalImg.width = this.maxWidth;
}
targetImg.width = originalImg.width;
}else{
if(eval(originalImg.height>this.maxHeight)){
originalImg.height = this.maxHeight;
}
targetImg.width = originalImg.width;
}
targetImg.src = originalImg.src;
targetImg.style.cursor = "hand";
targetImg.onclick = openImageTemplerOriginImg;
}else{
this.startSleep();
}
}
this.startSleep = function (){
timer_id = setTimeout(this.thisInstanceName+".imgChecker()", 100);
}
}
function openImageTemplerOriginImg(){
if(!endsWith(window.event.srcElement.src, 'temp.gif')){
var imgObj = new Image();
imgObj.src = window.event.srcElement.src;
var wopt = "scrollbars=yes,status=no,resizable=yes";
wopt += ",left=0,top=0";
if(imgObj.width >= (screen.width-20)){
}else{
wopt += ",width=" + (imgObj.width+18);
}
if(imgObj.height >= (screen.height - 60)){
}else{
wopt += ",height=" + imgObj.height;
}
var wbody = "<head><title>▒ 원본그림 보기</title>";
wbody += "</head>";
wbody += "<body style='margin:0px;padding:0px;' valign='middle' align='center'>";
wbody += "<a href='javascript:window.close()'><img src='" + imgObj.src + "' border=0></a>";
wbody += "</body>";
winResult = window.open("about:blank","",wopt);
winResult.document.open("text/html", "replace");
winResult.document.write(wbody);
winResult.document.close();
}
return;
}
팁과 해결
픽콤2006.04.24 · 12분 읽기 · 조회 3,229
[픽콤자작SCRIPT]이미지 사이즈 자동조정 : ImageResizer
픽콤2006.04.24 · 12분 읽기 · 조회 3,229이어서 읽기
팁과 해결↗
Synology 서비스 네트워크 포트
Synology 서비스는 어떤 네트워크 포트를 사용합니까? 다음 목록을 참조하십시오. 설정 유틸리티 유형 포트 번호 프로토콜 Synology Assistant 9999, 9998, 9997 UDP 백업 유형 포트 번호 프로토콜 Data Replicator…
2019.09.22·7분 읽기
팁과 해결↗
메일 리턴메세지 모음
아래의 첨부된 리턴 메시지를 참고하여 확인한다. Remote host said: 552 #5.3.4 message size exceeds limitremote host said: 550 sniper execeeds the limit size of email.상대 메일서버에서 받을 수 있는 메일…
2019.05.21·31분 읽기
팁과 해결↗
Diffi-Hellman key exchange
디피-헬만 키 교환이란 암호 키를 교환하는 방법이다. RSA와 마찬가지로 공통의 비밀키를 공유하기 위하여 만들어진 암호학적 통신 방법이다. RSA는 알다시피 암호화된 통신에서 공유될 비밀키를 공개키로 암호화하…
2018.02.22·3분 읽기
댓글 0
아직 댓글이 없습니다.