By Ben Nadel | Article Rating: |
|
October 15, 2007 11:00 AM EDT | Reads: |
23,496 |
ColdFusion 8 introduces the CFImage tag and dozens of image manipulation functions. We have already looked at reading and writing image files and we have covered the basic yet powerful image manipulation possible through CFImage tag actions alone. Now we know enough to be able to really start exploring the vast feature set of ColdFusion 8 image manipulation. When it comes to something like this your imagination is really the only limit, so it makes it a bit more difficult to come up with simple ways to learn this stuff. I find that task-based learning works well and will let us accomplish real-world goals while touching on many aspects of image manipulation.
We'll also cover adding watermarks to photos. There are a number of ways to do this like building the watermark from scratch or using an existing watermark image. To start with, I'm going to demonstrate using an existing watermark image. Hands down, this is going to give you the best results. ColdFusion 8 provides amazing image manipulation, but it's not a replacement for an image/photo editing application such as Adobe Fireworks (nor was that ever the intention).
To create my watermark image, I'm going to open up my sweet-ass Fireworks application and create a transparent canvas. The transparent canvas is important because we don't want the overlaid image to be too obvious. Then I'm going to type "Kinky Solutions" and give it a nice orange glow affect:

Notice that the background of this canvas (in Adobe Fireworks) has a checkered white-and-gray pattern. This signifies that the background is transparent. Then I export this image as a PNG32. This will compress the image while maintaining transparency.
Now, let's take a look at the image we're working with and the watermark we're going to apply:
<!--- Read in the original image. --->
<cfset objImage = ImageRead( "./blue_eyes.jpg" ) />
<!--- Write it to the browser. --->
<cfimage
action="writetobrowser"
source="#objImage#"
/>
<!--- Read in the Kinky Solutions watermark. --->
<cfset objWatermark = ImageNew(
"./kinky_solutions_watermark_png32.png"
) />
<!--- Write it to the browser. --->
<cfimage
action="writetobrowser"
source="#objWatermark#"
/>
Running this code, we get the following output:

Published October 15, 2007 Reads 23,496
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ben Nadel
Ben Nadel has worked with ColdFusion for eight years and is a super ColdFusion enthusiast. He blogs regularly about all aspects of Web development on his personal site, http://www.bennadel.com, and does his best to give back to the ColdFusion community through online code demos and his "Ask Ben" blog posts. He is also a Certified Advanced ColdFusion MX7 developer and is one of the lead programmers at Nylon Technology.
Apr. 20, 2018 03:45 AM EDT Reads: 1,817 |
By Elizabeth White ![]() Apr. 20, 2018 12:45 AM EDT Reads: 4,613 |
By Liz McMillan ![]() Apr. 19, 2018 11:00 PM EDT Reads: 9,806 |
By Liz McMillan ![]() Apr. 19, 2018 10:45 PM EDT Reads: 22,344 |
By Maria C. Horton ![]() Apr. 19, 2018 09:30 PM EDT Reads: 13,523 |
By Elizabeth White ![]() Apr. 19, 2018 08:30 PM EDT Reads: 1,002 |
By Elizabeth White ![]() Apr. 19, 2018 07:00 PM EDT Reads: 5,941 |
By Pat Romanski Apr. 19, 2018 02:00 PM EDT Reads: 2,042 |
By Pat Romanski Apr. 19, 2018 01:45 PM EDT Reads: 1,144 |
By Pat Romanski Apr. 19, 2018 01:30 PM EDT Reads: 2,063 |
By Elizabeth White Apr. 19, 2018 01:30 PM EDT Reads: 1,563 |
By Liz McMillan Apr. 19, 2018 01:15 PM EDT Reads: 1,584 |
By Pat Romanski ![]() Apr. 19, 2018 12:45 PM EDT Reads: 5,221 |
By Liz McMillan ![]() Apr. 19, 2018 12:45 PM EDT Reads: 3,642 |
By Yeshim Deniz Apr. 19, 2018 12:30 PM EDT Reads: 3,889 |
By Yeshim Deniz Apr. 19, 2018 12:15 PM EDT Reads: 4,863 |
By Liz McMillan ![]() Apr. 19, 2018 11:00 AM EDT Reads: 7,012 |
By Yeshim Deniz ![]() Apr. 19, 2018 08:30 AM EDT Reads: 1,838 |
By Liz McMillan Apr. 19, 2018 08:15 AM EDT Reads: 2,463 |
By Yeshim Deniz Apr. 19, 2018 08:00 AM EDT Reads: 3,003 |