Image formtool errors on cropping/padding when either width or height is set to 0
Description
Environment
Activity
Blair McKenzie December 1, 2010 at 6:41 AM
I can confirm that is definitely fixed as of the Jcrop rewrite.
Jason Barnes November 2, 2010 at 12:47 AM
If you leave it as blank it auto sets it to 0
<cfset stArgs.Height = "#arguments.stFields['#i#'].metadata.ftImageHeight#" />
<cfif NOT isNumeric(stArgs.Height)>
<cfset stArgs.Height = 0 />
</cfif>
the generateimage function has height and width types as numeric so currently it's mandatory for the arguments to be numeric.
e.g <cfargument name="height" type="numeric" required="false" default="#application.config.image.StandardImageHeight#" hint="The maximum height of the new image." />
All that aside, my understanding was crop won't work without having both a height and width as it is calculating the x and the y offsets based on these? If that's not true then it may just be a case of adding some checks to if 0. I haven't delved too deep into how the crop is actually calculated.
Geoff Bowers September 27, 2010 at 7:53 AM
I think we should be looking at 0 and "" (empty string) and (no attribute) all being the same. You can't have a 0 pixel setting in any event.
Jeff Coughlin September 26, 2010 at 2:29 PM
I believe you can set the height or width to blank (or not set them at all) and it should give you the desired effect. Setting it to zero is an actual value, so it should literally mean zero (only my opinion though .
Can someone verify that setting the values to blank or not using them at all works?
The image formtool supports the ability to set either height or width to 0 to indicate there is no restriction on that dimension (unlimited).
However since the options for crop and other resizing methods have been introduced an error is generated if you select these options on a property that has a 0 height or width. This is because for crop it requires the dimension to calculate the offsets.
Need to think how we handle this situation because there are times it would be good to set no boundaries on the height or width but still have the ability to crop as needed.