Entries for month: March 2007
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!
Adobe MAX 2007 Announced
Posted by David in MAX on March 1, 2007
Adobe MAX 2007 has been announced and this year the North American leg is in Chicago.
MAX North America: September 30-October 3, 2007, Chicago,IL
MAX EMEA: October 2007, Barcelona, Spain
MAX Japan: November 2007, Japan
Recent Comments