Entries Tagged as "ColdFusion"
ColdFusion 8: Watermarks, Transparency & Resizing
Posted by David in ColdFusion on August 22, 2007
![]()
I wanted to share some code examples that I have come across within the past few weeks regarding the new functionality in ColdFusion 8. My first example will be using the following functions: ImageRead(), ImageSetAntialiasing(), ImageScaleToFit(), ImageSetDrawingTransparency(), ImageGetWidth(), ImageGetHeight(), and finally ImagePaste(). Ok, here we go...
Error when cflocation is ran within onRequestStart
Posted by David in ColdFusion on April 24, 2007
There is some code in one of the projects I am working on that checks if a user is logged in within the onRequestStart application function. If the user is not logged in, the code redirects them to the login page using a cflocation. Although there is no visual error, i kept getting error emails thru my onError function stating there was a coldfusion.runtime.AbortException error happening:
An exception occurred when invoking a event handler method from Application.cfc The method name is: onRequestStart.
Reading various posts on this error on the web, I found that the this problem is well known and found some work-arounds. Here is one of them...
Within your onError function you can filter out the AbortException errors by doing this:
<cffunction name="onError" returntype="void">
<cfargument name="exception" required="true">
<cfargument name="eventname" type="string" required="true">
<cfswitch expression="#arguments.exception.rootcause.type#">
<cfcase value="coldfusion.runtime.AbortException">
<!--- do nothing --->
<cfreturn />
</cfcase>
<cfdefaultcase>
<!--- error handling code here --->
<cfdump var="#exception#" label="Exception">
</cfdefaultcase>
</cfswitch>
</cffunction>
That did the trick!
cfPicasa not working all of a sudden? This may be the fix!
Posted by David in ColdFusion on March 30, 2007
I use cfPicasa, by Charles Toro, on one of my websites to connect to my Google Picasa web albums. A couple of weeks ago, it stopped working for me. The albums listed fine, but when you would go into the album, you would get a " Element PHOTO:IMGSRC is undefined in a Java object of type class coldfusion.xml.XmlNodeList" error.
I looked into the error more and it seems that Google updated their RSS structures in the feeds for the album details. Anyways, its a pretty quick fix, so here is what you have to do to make it work again:
Change the getAlbumXML function in cfPicasa.cfc from this:
<cffunction name="getAlbumXML" access="public" output="false" hint="This parses then queries your album XML.">
<!--- Grab passed variable and fetch RSS link --->
<cfargument name="rsslink" type="string" required="yes">
<cfset variables.picasaURL["album"] = toString(toBinary(arguments.rsslink))>
<cfhttp url="#variables.picasaURL["album"]#"
method="GET"
timeout="15">
</cfhttp>
<!--- Now lets parse the XML file --->
<cfset albumXML = trim(cfhttp.filecontent)>
<cfset albumXML = XMLparse(albumXML)>
<!--- Create a query and loop the results --->
<cfset qAlbum = QueryNew("photo_imgsrc,photo_thumbnail")>
<cfset queryAddRow(qAlbum, ArrayLen(albumXML.rss.channel.item))>
<cfloop from="1" to="#ArrayLen(albumXML.rss.channel.item)#" index="i">
<cfloop from="1" to="#listLen(qAlbum.columnList)#" index="n">
<cfset querySetCell(qAlbum, listGetAt(qAlbum.columnList, n), albumXML.rss.channel.item[i][listGetAt(ReplaceList("#qAlbum.columnList#", "_", ":"), n)].XMLText, i)>
</cfloop>
</cfloop>
<!--- Time to query the query --->
<cfquery name="rqAlbum" dbtype="query">
SELECT *
FROM qAlbum
</cfquery>
<cfreturn rqAlbum>
</cffunction>
To this:
<cffunction name="getAlbumXML" access="public" output="true" hint="This parses then queries your album XML.">
<!--- Grab passed variable and fetch RSS link --->
<cfargument name="rsslink" type="string" required="yes">
<cfset variables.picasaURL["album"] = toString(toBinary(arguments.rsslink))>
<cfhttp url="#variables.picasaURL["album"]#"
method="GET"
timeout="15">
</cfhttp>
<!--- Now lets parse the XML file --->
<cfset albumXML = trim(cfhttp.filecontent)>
<cfset albumXML = XMLparse(albumXML)>
<!--- Create a query and loop the results --->
<cfset qAlbum = QueryNew("media_content,media_thumbnail")>
<cfset queryAddRow(qAlbum, ArrayLen(albumXML.rss.channel.item))>
<cfloop from="1" to="#ArrayLen(albumXML.rss.channel.item)#" index="i">
<cfloop from="1" to="#listLen(qAlbum.columnList)#" index="n">
<cfset querySetCell(qAlbum, listGetAt(qAlbum.columnList, n), albumXML.rss.channel.item[i]["media:group"][listGetAt(ReplaceList("#qAlbum.columnList#", "_", ":"), n)].XmlAttributes.url, i)>
</cfloop>
</cfloop>
<!--- Time to query the query --->
<cfquery name="rqAlbum" dbtype="query">
SELECT *
FROM qAlbum
</cfquery>
<cfreturn rqAlbum>
</cffunction>
What i did was change what qAlbum is set to as well as change the element structure when setting the querySetCell code. You have to add the "media:group" element to get things going again... Make sure you change your display code from #photo_imgsrc# and #photo_thumbnail# to #media_content# and #media_thumbnail# respectively.
Let me know if you have any questions!
ColdFusion MX 7.0.2 Cumulative Hot Fix 2
Posted by David in ColdFusion on March 28, 2007
Adobe has released a Cumulative Hot Fix for ColdFusion again. You can find more information as well as download here!
ColdFusion MX 7.0.2 Cumulative Hot Fix 1
Posted by David in ColdFusion on December 1, 2006
Just in case you havent heard, it was released yesterday and you can get it here:
Recent Comments