EXT에 그림이 표시되는 구성 요소 - [EXT]

2334 단어 ext
var fileUploadPhotoPreview = new Ext.Component({
            id: 'photoPreview',
            xtype: 'textfield',
            //height: 100,
            //width:100,
            autoEl: {
                tag: 'img', src: 'ws_Dell_11_1920x1200.jpg', id: 'photoPreview'
            },
            listeners: { 'render': function() {
                // 
                //DrawImage(fileUploadPhotoPreview.el.dom, 100, 100);
                //DrawImage(Ext.getCmp("photoPreview").el.dom, 100, 100) ;
                DrawImage(this.el.dom, 100, 100);
            }
            }
        });

 :
 // 
            function DrawImage(ImgD, width_s, height_s) {
                /*var width_s=139;
                var height_s=104;
                */
                var image = new Image();
                image.src = ImgD.src;
                if (image.width > 0 && image.height > 0) {
                    flag = true;
                    if (image.width / image.height >= width_s / height_s) {
                        if (image.width > width_s) {
                            ImgD.width = width_s;
                            ImgD.height = (image.height * width_s) / image.width;
                        } else {
                            ImgD.width = image.width;
                            ImgD.height = image.height;
                        }
                    }
                    else {
                        if (image.height > height_s) {
                            ImgD.height = height_s;
                            ImgD.width = (image.width * height_s) / image.height;
                        } else {
                            ImgD.width = image.width;
                            ImgD.height = image.height;
                        }
                    }
                }
                /*else{
                ImgD.src="";
                ImgD.alt=""
                }*/
            };

 : , , , , , 



좋은 웹페이지 즐겨찾기