ColdFusion 8's image functions + jQuery= a UI for adding text and color blocks into an image file
Join the DZone community and get the full member experience.
Join For Freeone of the new features in coldfusion 8 is the ability to manipulate images using coldfusion tags and functions. in addition to being to do generic image manipulations (like rotating, resizing, and cropping), you can also add text to an image using the imagedrawtext function, like in this example:
<!---assign the image file to the carimage variable--->
<cfimage name = "carimage" action="read" source="ferrari.gif"/>
<!---add the text "fast car!" to the image and place it 10 pixels from the left and 15 from the top--->
<cfset imagedrawtext(carimage, "fast car!, 10, 15)>
<!---display the new image--->
<cfimage source="#carimage#" action="writetobrowser">
a week ago, an idea popped into my head: "what if you could create a ui tool that would let a user decide what text should appear on the image and where it should appear?"

i decided to try and answer that question. the result: a working proof-of-concept application that lets you add text and blocks of color anywhere on a selected image using a ui tool powered by jquery javascript functions. when you're done manipulating the image, you submit the data defining your changes to coldfusion via an ajax call, and coldfusion creates a new image in temp space based on that data and displays it. you can save the new image down to your computer or store the data you submitted in the database so the image you made can be reproduced without permanently storing a new image file.
the fact that it only took me a week to do this (no more than 25 hours) is a testament to both the power and simplicity of coldfusion and jquery.
you can try out the proof-of-concept at: http://www.swartzfager.org/captionator .
JQuery
Blocks
Opinions expressed by DZone contributors are their own.
Trending
-
Top 10 Engineering KPIs Technical Leaders Should Know
-
SRE vs. DevOps
-
Structured Logging
-
How To Use Pandas and Matplotlib To Perform EDA In Python
Comments