Copy link to clipboard
Copied
<tr><cfoutput query="myDirectory" maxrows="1">
<td align="center"><a href="#Name#">
<cfimage source="#Name#" name="Name1">
<cfset ImageScaleToFit(Name,200,"")><!--- ---><img src="#Name#" /><br />#Name#</a></td>
<cfif myDirectory.currentRow MOD 3 EQ 0>
</tr>
<tr>
</cfif></cfoutput>
Whenever I try the code above I get the following error "
Unable to cast an object of type java.lang.String to Image. |
"
How can I use this tag and resize images that are stored in the variable Name and get them to display correctly? HELP!
Copy link to clipboard
Copied
You scale the image, first, then use CFIMAGE action="writetobrowser" to display it.
^_^
Copy link to clipboard
Copied
So how should it look then?
Copy link to clipboard
Copied
According to Adobe CF docs, resizing an image is done as:
<cfimage
required
action = "resize"
height = "number of pixels|percent%"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
width = "number of pixels|percent%"
optional
destination = "absolute pathname|pathname relative to the web root"
isBase64 = "yes|no"
name = "cfimage variable"
overwrite = "yes|no">
Then, writing it to the browser is like:
<cfimage action="writetobrowser" source="#image name from first cfimage tag#" format="gif" id="yourID" />
^_^
UPDATE: I just noticed ImageScaleToFit. Sorry. Place the following between the first two tags I wrote:
<cfset ImageScaleToFit(image name from first cfimage tag,options)>
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7975.html