tmt_img
Component tmt_img


Get dimensions, crop or resize jpg and png files. Require ColdFusion 6.1 or above


properties:
methods: crop, cropResize, getDimensions, getHeight, getSize, getWidth, init, resize
* private methods not listed

crop
public boolean crop ( required string source, string destination="[runtime expression]", numeric areaWidth="100", numeric areaHeight="100", numeric x="0", numeric y="0" )

Create a subimage, defined by a specified rectangular region, out of a jpg or png image file

Output: supressed
Parameters:
   source: string, required, source - Original image path, either local or absolute
   destination: string, optional, destination - Cropped image path, either local or absolute
   areaWidth: numeric, optional, areaWidth - Width of the specified rectangular region (pixel). Default to 100
   areaHeight: numeric, optional, areaHeight - Height of the specified rectangular region (pixel). Default to 100
   x: numeric, optional, x - Starting coordinate in the x axis (pixel). Default to 0
   y: numeric, optional, y - Starting coordinate in the y axis (pixel). Default to 0

cropResize
public boolean cropResize ( required string source, string destination="[runtime expression]", numeric resizeTo="200", numeric areaWidth="100", numeric areaHeight="100", numeric x="0", numeric y="0" )

First resize, then create a subimage, defined by a specified rectangular region, out of a jpg or png image file

Output: supressed
Parameters:
   source: string, required, source - Original image path, either local or absolute
   destination: string, optional, destination - Cropped/resized image path, either local or absolute
   resizeTo: numeric, optional, resizeTo - Width used to resize the original image. Default to 200
   areaWidth: numeric, optional, areaWidth - Width of the specified rectangular region. Default to 100
   areaHeight: numeric, optional, areaHeight - Height of the specified rectangular region. Default to 100
   x: numeric, optional, x - Starting coordinate in the x axis (pixel). Default to 0
   y: numeric, optional, y - Starting coordinate in the y axis (pixel). Default to 0

getDimensions
public struct getDimensions ( required string imgPath )

Returns a structure containing the dimensions (pixels) of a jpg, png or gif image file. Keys are: width and height

Output: supressed
Parameters:
   imgPath: string, required, imgPath - Image path, either local or absolute

getHeight
public numeric getHeight ( required string imgPath )

Returns the height (pixels) of a jpg, png or gif image file

Output: supressed
Parameters:
   imgPath: string, required, imgPath - Image path, either local or absolute

getSize
public numeric getSize ( required string imgPath )

Returns the size (KB) of a jpg, png or gif image file

Output: supressed
Parameters:
   imgPath: string, required, imgPath - Image path, either local or absolute

getWidth
public numeric getWidth ( required string imgPath )

Returns the width (pixels) of a jpg, png or gif image file

Output: supressed
Parameters:
   imgPath: string, required, imgPath - Image path, either local or absolute

init
public init ( string imgType="jpg", string interpolationType="bilinear", boolean scalingQuality="true", boolean throwOnSave="true", boolean renderQuality="true", boolean colorRendering="true", boolean dithering="true", boolean antialiasing="false" )

Pseudo-constructor, it ensure custom settings are loaded inside the CFC. Use it only if you want to modify default settings

Output: supressed
Parameters:
   imgType: string, optional, imgType - Image type used by the CFC (only jpg or png allowed). Default to jpg
   interpolationType: string, optional, interpolationType - By default the CFC use a bilinear algorithm for image interpolation; you can set it to nearest_neighbor or bicubic. Please note bicubic works only on Java 1.5. See http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html
   scalingQuality: boolean, optional, scalingQuality - By default the CFC use an image-scaling algorithm that gives higher priority to image smoothness rather than scaling speed. This is often the most important among all the quality related settings for resize operations. Turn it off if you prefer to emphasize speed
   throwOnSave: boolean, optional, throwOnSave - By default the CFC throws an exception if it fails to save an image on disk. Set this to false if you prefer to have the CFC returning false instead
   renderQuality: boolean, optional, renderQuality - By default the CFC use a rendering algorithm with a preference for output quality. Turn it off if you prefer to emphasize speed
   colorRendering: boolean, optional, colorRendering - By default the CFC use a color rendering algorithm with a preference for output quality. Turn it off if you prefer to emphasize speed
   dithering: boolean, optional, dithering - By default dithering is turned on, set it to false if you want to turn it off
   antialiasing: boolean, optional, antialiasing - By default antialiasing is turned off, set it to true if you want to turn it on

resize
public boolean resize ( required string source, string destination="[runtime expression]", numeric newWidth="100" )

Resize a jpg or png image file

Output: supressed
Parameters:
   source: string, required, source - Original image path, either local or absolute
   destination: string, optional, destination - Resized image path, either local or absolute
   newWidth: numeric, optional, newWidth - New width (pixels). Default to 100