SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation

Search

You can find the results of your search below. If you didn't find what you were looking for, you can create or edit the page named after your query with the appropriate button.

Results


SimplePie 1.0 "Razzleberry": 143 Hits
ace. (RC1) * Added the following constants: ''[[reference:SimplePie:SIMPLEPIE_BUILD]]'', ''[[reference:SimplePie:SIMPLEPIE_LINKBACK]]'', ''[[reference:SimplePie:SIMPLEPIE_NAME]]'', ''[[reference:SimplePie:SIMPLEPIE_URL]]'', ''[[reference:SimplePie:SIMPLEPIE_USERAGENT]]'', and ''[[reference:SimplePie:SIMPLEPIE_VERSION]]''. (RC1) * Added ''[[reference:SimplePie:set_favicon_handler]]'' to enable the caching and dis
How do I get a thumbnail from a YouTube feed?: 23 Hits
====== How do I get a thumbnail from a YouTube feed? ====== SimplePie 1.0 introduces full support for [[http://search.yahoo.com/mrss|Media RSS]] -- a popular set of tags geared for media files, and are added to RSS and Atom feeds. :!: This tutorial assumes that you're already familiar with using SimplePie, including looping through items. This is only sample code, and you should not create real pages using the (horrid) HTML generated by this example. ===== Compatibility ===== * Supported in SimplePie 1.0. * Code in this tutorial should be compatible with PHP 4.3 or newer, and should not use PHP short tags, in order to support the largest number of PHP installations. ===== Code source ===== <code php><?php // Make sure that SimplePie is loaded require_once('simplepie.inc'); // Let's simplify this with the shorter syntax. http://simplepie.org/wiki/reference/simplepie/start $feed = new SimplePie('http://youtube.com/rss/global/top_favorites.rss'); // Make sure the content is being served out to the browser properly. $feed->handle_content_type(); foreach ($feed->get_items() as $item) { // As long as an enclosure exists... if ($enclosure = $item->get_enclosure()) { // Display the thumbnail as an image and link it back to the YouTube page, and adding the video's title as a tooltip for the link. echo '<a href="' . $item->get_permalink() . '" title="' . $item->get_title() . '"><img src="' . $enclosure->get_thumbnail() . '" /></a>'; } } ?></code>