Adding Image Uploader to HTML Code
Different browsers have different syntax to insert Java applets. None of browsers except of Internet Explorer can work with ActiveX controls. Hence, you may think that it is necessary to write different codes for different browsers to work with Image Uploader.
Fortunately, you do not need to do it. Image Uploader comprises a special helper JavaScript file called iuembed.js. This JavaScript unifies work with different browsers, as well as provides some handy features. You can learn about this script more detailed in the Image Uploader Embedding Scripts Library Reference.
So, to insert Image Uploader to the page, follow these steps:
Copy these files to your web server:
ImageUploader6.cab
ImageUploader6.jar
iuembed.js
Link iuembed.js with the page by inserting the following line in the beginning of the page:
JavaScript
<script type="text/javascript" src="iuembed.js"></script>
Add JavaScript block in the position where you want to insert Image Uploader. This JavaScript should do the following:
Create an instance of ImageUploaderWriter.
If you do not want to use ActiveX or Java version, set the activeXControlEnabled or javaAppletEnabled correspondingly to false.
If ActiveX version is enabled, specify URL to the ImageUploader6.cab file via the activeXControlCodeBase property. You can use relative URL.
If Java version is enabled, specify URL to the folder where ImageUploader6.jar file is located via the javaAppletCodeBase property. You can use relative URL. If the JAR file is located in the same folder with the page, use ./.
Configure Image Uploader by adding parameters using the addParam method.
Call the writeHtml method.
Here is an example of JavaScript that embeds Image Uploader into the page.
JavaScript
<script language="javascript" src="iuembed.js"> </script>
<script language="javascript">
var iu = new ImageUploaderWriter("ImageUploader", 650, 450);
// If you do not want to use ActiveX or Java version, set the appropriate
// property to false.
iu.activeXControlEnabled = true;
iu.javaAppletEnabled = true;
iu.activeXControlCodeBase = "ImageUploader6.cab";
iu.javaAppletCodeBase="./";
// ... initialize params as described in the next topic ...
// As soon as you call this method, all necessary HTML code is inserted
// into the page on the current position. Alternatively, you can
// get the string with appropriate HTML code using the getHtml method,
// and write it to the necessary position manually (maybe with some modifications).
iu.writeHtml();
</script>