Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Beefed Up RSS2 Template For Consumption With The Google Feed API Slide Show Control

DZone's Guide to

Beefed Up RSS2 Template For Consumption With The Google Feed API Slide Show Control

·
Free Resource
// description of your code here

xml.instruct!

# RSS2 rxml template based on: http://snippets.dzone.com/posts/show/558
xml.rss "version" => "2.0", \
        "xmlns:dc" => "http://purl.org/dc/elements/1.1/", \
        "xmlns:media" => "http://search.yahoo.com/mrss/" do

    xml.channel do

        xml.title       "foto-foo :: public timeline"
        xml.link        url_for :only_path => false, :controller => 'feeds'
        xml.pubDate     CGI.rfc1123_date(@images.first.updated_at) if @images.any?
        xml.description "foto-foo :: public timeline image feed"

        host = "AWS.S3.storage.host"
        @images.each do |img|
            img.url = "http://#{host}/#{img.name}"
            xml.item do
                xml.title       img.name
                xml.link        url_for :only_path => false, :controller => 'feeds', :action => 'show', :id => img.id
                xml.description ""
                xml.enclosure :url => "#{img.url}", :type => "image/jpg"

                xml.pubDate     CGI.rfc1123_date img.updated_at
                xml.guid        url_for :only_path => false, :controller => 'posts', :action => 'show', :id => img.id
                xml.author      "\"user-#{img.user_id}\" (#{img.user_id}@foto-foo.com)"

                xml.media :group do
                    xml.media :title, img.name
                    xml.media \
                        :content, :type => "#{img.mime}", :medium => "image", \
                        :url => "#{img.url}"
                        xml.media :credit, "#{img.credit.txt}", \
                                :role => "#{img.credit.role}" 
                    xml.media :description, "#{img.desc}", :type => 'plain'
                    xml.media :keywords, "#{img.tags}"
                    xml.media :thumbnail, \
                        :width => "#{img.thumbnail.widh}", \
                        :height => "#{img.thumbnail.height}", \
                        :url => "#{img.thumbnail.url}"
                end
            end
        end

    end
end

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}