PicLens

Several functions are available to create your own mediaRSS feed or add the link and/or javascript needed for PicLens (Lite). You can implement hook_mediarss_items() in your own custom module to pass along media items. The link to the mediarss feed should then look as this:

http://example.com/piclens/example_module/args

  • piclens: menu callback in the piclens module. This function will then call module_invoke
    to get the items from hook_mediarss_items()
  • yourmodule: name of your module
  • args: optional arguments needed to pass to your hook

<?php
/**
* Implementation of hook_mediarss_items.
*/
function example_module_mediarss_items($args = array()) {
 
$items = '';
 
// get all my items
 
$my_items = db_query("SELECT * FROM {my_table}");
  while (
$my_item = db_fetch_object($my_items)) {
   
$item = array(
     
'title' => $my_item->title,
     
'link' => $my_item->link,
     
'thumbnail' => file_create_url($my_item->thumbnail),
     
'content' => file_create_url($my_item->content),
    );
   
$items .= mediarssapi_format_item($item);
  }
  return
$items;
}
?>

All available in the PicLens module.

  • mediarssapi_feed_url($url, $title);
    This function adds the rss feed with the $url to your own menu callback providing the feed
    into the head of your document. $title is optional.
  • mediarssapi_format_item($item);
    This function formats one item (image, video) into a valid xml structure for the piclens feed.
    $item is an array with following properties:
    1. title : title image or video
    2. link : direct link to content
    3. thumbnail : thumbnail url image or video
    4. content : content url of image or video
  • mediarssapi_rss($items);
    This function outputs the feed. $items is a string formatted xml list of media items.
  • mediarssapi_piclens_lite_javascript()
    This function adds the javascript for the PicLens Lite into head of your document.
  • mediarssapi_piclens_lite_link($image_or_text, $drupal_set_message, $url)
    This function returns a link to start the PicLens Lite slideshow.
    $image_or_text: display something different than default text and arrow.
    If $drupal_set_message = TRUE, the link will be inserted as a drupal message, otherwhise
    the link is simply returned. Inside this function theme('piclens_lite_html_link'); is called
    to return the html. You can override the theming with phptemplate_piclens_lite_html_link() off course.
    $url: add your custom url if you have multiple feeds per page.
 
 

Drupal is a registered trademark of Dries Buytaert.