ColdFusion Image Manipulation Functions Return Nothing

Posted April 24, 2008 at 9:18 AM

Tags: ColdFusion

I have been fooling around with some dynamic image method execution when something I already knew suddenly occurred to me in a different way - ColdFusion image manipulation functions return "Nothing". And, I don't mean that they simply don't return the resultant image object - I mean, just as the documentation states, they return "Nothing" - void. When I realized this, I started to look at all the other ColdFusion methods that don't echo back their primary argument and I realized that it is very hard to find other methods that return Nothing. All of the array and struct methods return true or false depending on success of execution; all the query manipulation methods return properties based on the actions; all other functions return actual values.

Are ColdFusion image manipulation functions the only built-in methods that return no value? And, if so, I wonder why these functions do this?

Post Comment  |  Ask Ben  |  Permalink  |  Print Page




Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

Reader Comments

Apr 24, 2008 at 10:06 AM // reply »
102 Comments

Hmmmm ... you may be right, Ben. Never thought about it, but even the functions I normally use as if they returned nothing, do actually return Boolean. Like the query functions, which I normally don't even assign to anything:

<cfset queryAddRow(myQry)>
<cfset querySetCell(myQry, "myCol", myVal)>

They can just as well be used as:

<cfset rowTest = queryAddRow(myQry)>
<cfif rowTest>
<cfset colTest = querySetCell(myQry, "myCol", myVal)>
<cfelse>
<cfthrow message="Could not add a row to '#myQry#' for some reason">
</cfif>

Interesting.


Apr 24, 2008 at 10:09 AM // reply »
6,516 Comments

@JFish,

Yeah, when I realized this, I would like, Oh let me go check out things like QueryAddRow() cause those have no return value... but then, it turns out they did.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »
Nov 21, 2009 at 10:56 AM
HostMySite.com Has The Best ColdFusion Hosting
@Mehul, Yes very nice people, however several downtimes per day which was not acceptable. Hence we had to move out. I am glad you are having good luck with them so far. ... read »
Nov 20, 2009 at 11:32 PM
Five Months Without Hungarian Notation And I'm Loving It
I've used headless camel case for years for not only ColdFusion variables, but also SQL tables and fields... pretty much everything involving code. I also subscribe to the "don't abbreviate and clea ... read »