Getting an image’s information using the CFIMAGE tag in ColdFusion

Readability

Getting an image's information using the CFIMAGE tag in ColdFusion

The fol­low­ing exam­ple shows how you can get an image’s infor­ma­tion (width, height, alpha, etc) using the <CFIM­AGE> tag in Cold­Fu­sion, or by using the imageNew() and imageInfo() methods.

And the out­put of the <CFIM­AGE> tag is as fol­lows:

Or, you could get the image info in a <CFSCRIPT> block, as seen in the fol­low­ing example:


img = imageNew("adobe_logo.gif");
getImageInfo = imageInfo(img);
writeDump(getImageInfo);

The following example shows how you can get an image’s information (width, height, alpha, etc) using the <CFIMAGE> tag in ColdFusion, or by using the imageNew() and imageInfo() methods.

<p><img src="../images/cf9.png" /></p>
 
<cfimage action="info" source="../images/cf9.png" structName="getImageInfo" />
<cfdump var="#getImageInfo#" />

And the output of the <CFIMAGE> tag is as follows:

Or, you could get the image info in a <CFSCRIPT> block, as seen in the following example:

<cfscript>
img = imageNew("adobe_logo.gif");
getImageInfo = imageInfo(img);
writeDump(getImageInfo);
</cfscript>

Leave a Reply

Your email address will not be published.