Edited by MattP on 05/07/03 08:21 AM (server time).
Edited by Tim__D on 01/12/06 06:44 AM (server time).
I currently have a solution for this running in our production environment. It includes the following functionality:1) When user updates an image field, FormAPI:callServer runs a perl script to determine image size2) if image size is with in acceptable limits the form accepts the image3) if image size is outside of the acceptable limits it will either give user an alert or ask the user to change the image sizeIt's easy to set up. I can share code if you haven't already figured this out.Thanks,Brian
Register an onchange event and use normal jscript to preload and get the image properties. Then you can do whatever you want. In the past I have allowed the image to be placed but served a warning to the user. Check this for errors as I have modified it quickly for you as an example. //Image based event handler IWEventRegistry.addItemHandler("/Image", "onItemChange", setImage); //IMAGE PRELOAD //imgObj - the name of the object associated with the image //imgSrc - the source filename (url) of the image function doPreload(imgObj,imgSrc) { if (document.images) { eval(imgObj + ' = new Image()'); eval(imgObj + '.src="' + imgSrc + '"'); } } function setImage() { var strImagePath = IWDatacapture.getItem("/Image").getValue(); doPreload('objImage',strImagePath); //validate input if((objImage.width > 182) || (objImage.height > 300)) { alert('The image you have selected is larger than the recommended size.\nThe maximum recommended width and height is 182 x 300 Pixels.\nUsing this image could cause the page to display incorrectly.'); } setTimeout('IWDatacapture.getItem("/Image Width").setValue((objImage.width))',1000); setTimeout('IWDatacapture.getItem("/Image Height").setValue((objImage.height))',1000); } Edited by Tim__D on 01/12/06 06:44 AM (server time).