cached_image

(ReachRSS >= 0.91)
cached_image -- Outputs the locally cached image to the browser

Description

boolean cached_image ( image_url )

Each RSS/RDF channel can reference an image to use to represent the channel or provider. ReachRSS caches these channel images locally so that they display fast and don't cause stress on the provider's servers.

This function accepts the URL of an image and, if an image exists in the local cache, outputs the binary image data to the browser, with the appropriate content type headers. cached_image() returns true on success, false if the image url requested does not exist in the local cache.

Example 1. cached_image() example

$ReachRSS = new ReachRSS();
$ReachRSS->Startup();
$ReachRSS->add_channel("http://www.comicalert.com/public/popular24.xml");
$image_url = $ReachRSS->channel_image_url(
                          "http://www.comicalert.com/public/popular24.xml"
                        );
$ReachRSS->cached_image($image_url);

This example will subscribe ReachRSS to the "most popular comics" feed at Comic Alert! and then output the channel image for Comic Alert! to the browser.

See also channel_image_url(), channel_image_type(), channel_property(), add_channel()

Back to Function List

 

Home | Features | Samples | Demo | Download | Register | Help / Support