Resize image
If you need to resize an image that is greater than x pixels. You can put this example in the onPrepare() of your image.
The script will grab the height and width of an image in inches. Remove "in" and then convert the number into pixels.<br />
After we know how many pixels the image is you can check to see if it is greater than the size you want to allow. If it is then you can resize the image. Otherwise the image is left alone to stay the same size.
// Approx. how many pixels in one inch var oneInch = 96; // Get the height in inches, returns as a string var width = this.width; var height = this.height; // Remove "in" from the string var xwidth = width.replace("in",""); var xheight = height.replace("in", ""); // Covert the string to int using parseInt() var yheight = parseInt(xheight); var ywidth = parseInt(xwidth); // Convert inches to pixels. 1 inch ~= 96 pixels yheight = yheight * oneInch; ywidth = ywidth * oneInch; // If the image height > 250 pixels we can change our max height here if(yheight > 250) { this.height = "250px"; } else { // Do nothing } // If the image width > 250 pixels we can change our max width here if(ywidth > 250) { this.width = "250px"; } else { // Do nothing }<br />
The script will grab the height and width of an image in inches. Remove "in" and then convert the number into pixels.<br />
After we know how many pixels the image is you can check to see if it is greater than the size you want to allow. If it is then you can resize the image. Otherwise the image is left alone to stay the same size.
Warning
No formatter is installed for the format ipb
0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 104 General Questions
- 141 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management