EMBEDDING AN IMAGE IN AN RSS FEED - Aug 6th, 2010


RSS feeds can be finicky, but this should work to display an image as part of an item in the foreach loop.



<description>
<![CDATA[

<p><u>Here is an image thumbnail</u> </p>

<?php foreach ($record['image'] as $upload): ?>
<img src="http://www.my_web_site.com<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php endforeach ?></p>

<p align="center"><strong><font color="#ba1419">My First Image</font></strong></p>
]]>
</description>



In general, any time you want to treat code as "code" in an RSS feed, you need to surround the code with CDATA tags.

Note: You'll have to add the URL to change the relative image thumbURLpath location to an absolute URL.

Any code (formatting, etc) within the CDATA tags will be treated as code and should render correctly.



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service