| CFX_ImageCR3: |
Website Support Purchase |
|
|
|
| » Welcome » Reference » How does it work? | Table of Contents : Keyword Index |
|
|
|
| « Return Values (prev) | (next) Examples » |
|
|
|
|
How does it work? This section will give developers an understanding of the tags default mode. 0. Determine mode of operation
If the load attribute exists, ImageCR will operate in its default mode, aka 'normal' mode. Otherwise, the mode is determined based on the existence of getimageinfo, getimagedetails, getdefaultsave, setdefaultsave or getversion. Only the default mode of operation continues to the next step in these details. The other modes perform relatively simple tasks and quickly return. Only the default load & save mode is detailed below. 1. Calculate location of output
The first thing the tag does is calculate the location of the output file. This is not merely the value of save. If save is not defined... the "DefaultSave" is used...
DefaultSave is the global value set with
setdefaultsave. If you do set DefaultSave, it should
be done in a Cached Global Section of your
application. In previous versions of CFX_ImageCR the DefaultSave (know then as the "default cachedir") was configured
during installation, stored in the registry, and read when Coldfusion
first initialized the CFX DLL. It is most often meant to be set globally.
If save ends with "\" or "/", all directories will be created as necessary. If save is a directory... an "autoname" is calculated... An autoname is unique identifier for the image which will result from this CFX_ImageCR call. The identifier will be unique to ImageCR calls with the same attributes and input file, allowing intelligent caching. This image fingerprinting technique additionally incorporates the modification timestamp of the input file. This specific behaviour can be toggled via detectchanges. By default, detectchanges is enabled, allowing changes in an input file to be reflected by refreshing the output file. For autonamed files, the format default changes to "jpg". Finally, the autoname is given an extension. Please note the tag will not delete previously generated images in any case, autonamed or otherwise. Autonaming is best suited to specific implementations by those who understand it. Remember, autonaming occurs after save may have picked up the DefaultSave value, so you can set DefaultSave to a directory. This is most often what you will want to do. This is similar to the version 2 "default cachedir". 2. Consider generating a new image
ImageCR decides to create an output image in the following cases:
The calculated output location does not exist
or... nocache is set to 1 or... The input and output locations are the same If CFX_ImageCR decides not to create an image, it heads to the last step, step 5, to set return values. In most implementations this is what ImageCR will spend most of its time doing. This is caching in action. Coupled with autonaming and detectchanges, the caching can be fairly clever and independent. 3. Load input image
CFX_ImageCR will now attempt to load the input image... If the load fails, CFX_ImageCR heads to the last step, step 5, to set return values. 4. Save output image
CFX_ImageCR performs the operations specified and will attempt to save the output image. If the save fails, CFX_ImageCR will throw a Coldfusion exception noting the error. The save can fail if you do not have the required permissions, disk space, etc. This is one of the most common errors users ask us about. 5. Set return values and return
If returnextras is set, as it is by default, ImageCR will set these return values:
imagecr.width
imagecr.height imagecr.filename imagecr.directory imagecr.format imagecr.filesize imagecr.existed imagecr.created imagecr.loadfailed imagecr.savefailed imagecr.error imagecr.errortype imagecr.errormessage imagecr.returnvalues CFX_ImageCR returns and the call is completed. In most cases this happens instantly because the output image was created previously. See also:
|
|
|
|
|
| « Return Values (prev) | (next) Examples » |
|
|
|
| Copyright © Efflare Systems | |