Images in rss feed using Coldfusion and CFFEED

Vancoso

New Member
I have a script that generates an xml file with Coldfusion and its CFFEED tag. It works pretty good except for images. I understand that you have to use encapsulate the image in CDATA in order to display it. I am not sure if I have set it up correctly because the images are not showing up in my Google Reader / Feedly feed. Here is the code:\[code\]<cfquery datasource="data" name="queryT">SELECT *FROM qTableWHERE ... ORDER BY...</cfquery> <cfset RssStruct = StructNew() /><cfset RssStruct.link = "https://www.url.com" /><cfset RssStruct.title = "noteStreamer" /><cfset RssStruct.description = "url Blog" /><cfset RssStruct.image.url = 'https://www.url.com/assets/img/ns.png' /><cfset RssStruct.image.title = 'Site Name' /><cfset RssStruct.image.link = 'https://www.url.com' /><cfset RssStruct.pubDate = Now() /><cfset RssStruct.version = "rss_2.0" /><cfset RssStruct.item = ArrayNew(1) /><cfset threadlist = ""><cfset index = 1><cfloop query="queryT"> <cfif listcontains( threadlist , '#id#' ) eq 0> <cfset threadlist = ListAppend(threadlist, '#id#')> <!--- Here let's clean up and ensure that all values are XML Compliant ---> <cfset RssStruct.item[index] = StructNew() /> <cfset RssStruct.item[index].guid = structNew() /> <cfset RssStruct.item[index].guid.isPermaLink ="YES" /> <cfset RssStruct.item[index].guid.value = 'https://www.url.com/page.cfm?itemid=#queryT.id#' /> <cfset RssStruct.item[index].pubDate = createDate(year(Posted), month(Posted), day(Posted)) /> <cfset RssStruct.item[index].title = xmlFormat(#title#) /> <cfset RssStruct.item[index].Body = xmlFormat(#Body#) /> <cfset RssStruct.item[index].description = StructNew() /> <cfset RssStruct.item[index].description.value = 'http://stackoverflow.com/questions/15734840/<![CDATA[ <img src="https://www.url.com/assets/Photos/photo/#id#.jpg"> #body# ]]>' /> <cfset RssStruct.item[index].link = 'https://www.url.com/page.cfm?item=#queryT.id#' /><br> <cfset index = index + 1> </cfif></cfloop><!--- Generate the feed and save it to a file and variable. ---><cffeed action="create" name="#RssStruct#" overwrite="true" xmlVar="myXML" outputFile = "Feed.xml" />`\[/code\]
 
Back
Top