I want to scale an image using a scale amount value passed to it from a FORM. The thing is that I'm getting syntax errors.
I have a hidden input in my form like this:
<input type="hidden" name="scale" value="0.16"/>
In my page that processes the image I want it to do this:
<cfset ImageScaleToFit(MyImg, ARGUMENTS.SCALE%, "", "highestQuality")/>
I know the above cfml is not correct but I don't understand how to convert the scale value into a percentage that ColdFusion can work with. In this case, 0.16 means I want the image to be 16% of the original size. So I'm reducing it by 84%. If the scale was 3.5 then I need to increase the size of the image by 350%.
ARGUMENTS.Scale%
is giving me syntax errors. For some reason its not being compiled to 0.16%
0.16
so that it ends up being a correct percentage that ColdFusion can work with to correctly scale the image either up or down?ImageScaleToFit
is looking for the value in pixels. You need to take the original image width and multiple that by your scale value
<cfset ImageScaleToFit(MyImg, ARGUMENTS.SCALE * originalImageWidth, "", "highestQuality")/>