Testing an images size, then resizing...can't get variables right.
Hi all,
Complete ColdFusion newbie who's taken over a massive website written in CF8. I'm slowly fumbling my way through things but thought I should at least start using the forums for help a bit more than spending countless hours working stuff out on my own.
I've got the following code which checks an images size, then tries to resize if its too big. It's of course failing with details below. Any help would be great. The code is:
| <cfif FileExists("#SITE_PATH#/images/wines/bottles/big/#fileName#")> | |||||||
| <cfset bottleImage = "#SITE_PATH#/images/wines/bottles/big/#fileName#"> | |||||||
| </cfif> | |||||||
| <cfif bottleImage.width gt 345> | |||||||
| <cfset imageScaleToFit(#bottleImage#,"250","")> | |||||||
| <img src="#bottleImage#" border="0" alt="#prdName#"> | |||||||
| </cfif> |
I'm getting an error which states:
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
I've just started learning Java at work so I understand that it thinks bottleImage is a String. But then I'm asking it the test the Strings image size which of course doesn't work. How do I feed into ColdFusion the actual image "object" so that it can then use methods based on it?
Thanks all!
Matt
