|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Learning CF8 CFImage Functionality is Just Awesome!
Integration into Tag and Scripting Language is a Welcome Development
By: Ben Nadel
Jul. 31, 2007 08:00 PM
The problem here is that ColdFusion is not recognizing the query string of the URL. This also means that you can't grab URLs that are served by ColdFusion using CFContent. This will only work to direct image URL access. This seems like a bug to me as I would have assumed it was just doing a binary grab via CFHttp (or something like that), but I guess there is more to it than I can understand. I would rather it try to grab the resultant data and throw an exception if the read fails. Of course, there is a hack to get around this: you can add the image format to the query string: http://localhost/testing/cf8/lady.jpg?referrer=bennadel&type=.jpg This will work quite nicely. You get the idea here that ColdFusion is just doing some sort of ListLast() type functionality on the URL to get the file extension. A bit of a hack, but it works if you need it to. The next input type is a ColdFusion image object. We don't have to perform actions just on new images; we can perform them on existing image objects: <!--- Read the image into ColdFusion memory. ---> The next input type is the BLOB (Binary Large Object Bitmap) and the byte array. I am grouping these two together because I am sure what the difference really is. To me, they are both binary objects (I think). I don't generally deal with these sorts of objects: <!--- Read in the binary image data. ---> When you read in an image in this fashion, the source attribute is empty. The next input type is a Base64 encoded string. The CFImage tag has the boolean attribute, IsBase64, which flags the input as being Base64 data. This doesn't mean the target file is a Base64 data text file - this means the actual input value is Base64 image data: <!--- Read in the binary image data. ---> I don't deal with Base64 encoded images all that often, but this seems like something that could be very useful when put into clever hands. When you read in an image in this fashion, the source attribute is empty. The Base64 data does not require headers to be used. For all the above "Read" demos, we were really just getting the info about the image. If you want to actually read the image into a ColdFusion variable (in the form of the coldfusion.image.Image data type), use the action "READ": <!--- Read image into memory. ---> While this reads the image into memory, if you CFDump it out, you'll get the same output as if you were dumping out the INFO action result. Now that we have covered the tag-based reading, let's examine reading in images using the new ColdFusion 8 image functions. To start with, let's look at ImageRead(). Like the CFImage tag, the ImageRead() function can take a variety of source types:
The ImageRead() function takes this is as the only argument: <!--- Read in the image using an absolute path. --->
Reader Feedback: Page 1 of 1
Your Feedback
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||