ImageNew(), like most other stub functions, initializes an image
*object* which can then be manipulated in a number of ways. No-
argument constructors are the norm in traditional OOP development with
languages like Java and it makes perfect sense to have them when you
understand the underlying concepts of OOP development. ImageNew() is
no different in concept than StructNew(). You use StructNew() to
initialize structures (which are really just objects), you [can] use
ImageNew() to initialize an image [object] in the same way. You can
either pass parameters to ImageNew() when you create the image
(source, width, height, imageType, canvasColor) as well as the
following:

    * Absolute or relative pathname: The image file located at the
specified pathname on a disk is read and returned as a ColdFusion
image.
    * URL: The image from the specified URL is read and returned as a
ColdFusion image.
    * Width and height (imageType is optional): A blank ColdFusion
image with the specified attributes is returned.
    * ColdFusion image variable: An image variable in memory; for
example, #myImage#.
    * A BLOB from a database that contains image data.
    * A byte array that contains Base64 image data.
    * A Java buffered image.

Or you can use the flurry of other methods provided to further
manipulate a image object after calling ImageNew() without parameters
(which is what Farcry does if I remember correctly).

As for a certain commercial engines adoption of image functionality,
it was born from the root of open source CFCImage and related image
manipulation code from back in the day and was further refined and
integrated to provide ColdFusion developers with the ability to create
images on the fly. It was not the brainchild of some intern - it was
the brainchild of the CF community and has served me, personally, any
many of my clients, very well.

So, I hope that helps you to understand why we have functions like
ImageNew() in the language and why we can call them with no arguments.
If you're not familiar with OOP concepts I strongly recommend
investing in a good Java OOP design patterns book and grab a copy of
Matt Gifford's OOP in ColdFusion book as well. Both will go a long way
towards helping you understand the concepts and reasoning behind no
argument constructors like ImageNew().

-- Denny

On Jan 25, 4:05 am, Alan Williamson <[email protected]> wrote:
> I am curious ... if you pass nothing into it, ImageNew(), what size of
> canvas are you expecting here?
>
> Doesn't make any sense to me to just call ImageNew() on its own.  Yes we
> can default it to say 100x100 but you are kinda of leaving the
> underlying engine to make choices for you.
>
> So this isn't an incompatibility, but a common-sense approach.   Tell me
> what the default image size should be, and i will default it.
>
> .. /don't get me started on yet another cluster-f*ck of CFML functions
> that a certain-commercial engine introduced .. and they claim there is
> design and thought that goes into these  ... shakes head ... yeah maybe,
> by their intern!/
>
> JEAguilar wrote:
> > The Stack Trace suggests an incompatibility with the imageNew()
> > function. It looks like ACF and Railo have no required parameters for
> > this function (http://www.cfquickdocs.com/cf9/#imagenew,
> >http://wiki.getrailo.org/wiki/3-1-Functions:ImageNew/wiki/3-1-Functio...)
> > Is the OpenBD implementation of imageNew() compatible with other CF
> > engines?
>
>

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 official manual: http://www.openbluedragon.org/manual/
 Ready2Run CFML http://www.openbluedragon.org/openbdjam/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to