datacapture.cfg DCT / hp teamsite 中的图像大小
image size in datacapture.cfg DCT / hp teamsite
我有一个浏览区域,用户可以在其中浏览和输入图像。
我需要知道图像的高度和宽度来限制它。
var img= IWDatacapture.getItem("banners/mobile-banner/mobile-content[1]/main-image");
var params = new Object();
if(img.length==undefined)
{
var savnm = IWDatacapture.getWorkarea() + img.getValue();
params.savnm = savnm;
var server = window.location.hostname;
IWDatacapture.callServer("http://"+server+"/iw-bin/iw_cgi_wrapper.cgi/getFileSize.ipl", params,true);
}
调用服务器后,我不明白如何访问图像的属性。
试试这样的东西:
// Get the full image URL:
var img = IWDatacapture.getItem("banners/mobile-banner/mobile-content[1]/main-image");
// Note: I'm not sure if the following will generate the correct URL, but it should be close. Double check the "workarea" part.
var fullImagePath = "/iw/cci/meta/no-injection/iw-mount/" + IWDatacapture.getWorkarea() + img.getValue();
// Then load the image in the browser to get the dimensions:
var image = new Image();
image.onload = function(){
var height = image.height;
var width = image.width;
// Whatever you want to do
}
image.src = fullImagePath;
我有一个浏览区域,用户可以在其中浏览和输入图像。
我需要知道图像的高度和宽度来限制它。
var img= IWDatacapture.getItem("banners/mobile-banner/mobile-content[1]/main-image");
var params = new Object();
if(img.length==undefined)
{
var savnm = IWDatacapture.getWorkarea() + img.getValue();
params.savnm = savnm;
var server = window.location.hostname;
IWDatacapture.callServer("http://"+server+"/iw-bin/iw_cgi_wrapper.cgi/getFileSize.ipl", params,true);
}
调用服务器后,我不明白如何访问图像的属性。
试试这样的东西:
// Get the full image URL:
var img = IWDatacapture.getItem("banners/mobile-banner/mobile-content[1]/main-image");
// Note: I'm not sure if the following will generate the correct URL, but it should be close. Double check the "workarea" part.
var fullImagePath = "/iw/cci/meta/no-injection/iw-mount/" + IWDatacapture.getWorkarea() + img.getValue();
// Then load the image in the browser to get the dimensions:
var image = new Image();
image.onload = function(){
var height = image.height;
var width = image.width;
// Whatever you want to do
}
image.src = fullImagePath;