This is a slideshow MOD that uses the Google AJAX RSS Slideshow API.
It can display JPEG and PNG pictures, and is customizable. The Google AJAX RSS Slideshow API is described here, and there are examples of what the slideshow looks like in action:
http://www.google.com/uds/solutions/slideshow/index.htmlTo use this Google API, this mod changes/adds to 4images the ability to produce a Media RSS 2.0 compliant RSS feed, in addition to the regular new pictures RSS feed that it already produces. This feed is used for the Google Slideshow API, but could be used standalone.
As a technical detail, this MOD uses the slideshow API slightly differently, in that it doesn't depend on your site having thumbnails for your pictures - it feeds the slideshow the actual pictures themselves.
IMPORTANT: To be able to use this MOD, you have to
get your own Google API key. It's free and simple, but you have to get one and put it in the new file sshow.php linked below.
Hope this is useful to people!
Chris Andrichak
changed files:rss.php
categories.php
templates/default/categories.html
new files:sshow.php
remember to get the Google API keytemplates/default/mrss.xml
templates/default/mrss_item.xml
-->
download zip
rss.php
insert after:
$main_template = 'rss';
this code
$sub_template = "rss_item";
$media_template = 'mrss';
$media_sub_template = "mrss_item";
change:
@define('RSS_MAX_ITEMS', 30);
to
@define('RSS_MAX_ITEMS', 100);
change:
if (isset($HTTP_GET_VARS['items']) || isset($HTTP_POST_VARS['items'])) {
to
// # of images in category is passed in over HTTP Get (increased max limit to accomodate
// larger category total sets
if (isset($HTTP_GET_VARS['slc']) || isset($HTTP_POST_VARS['items'])) {
$num_items = (isset($HTTP_POST_VARS['items'])) ? intval($HTTP_POST_VARS['items']) : intval($HTTP_GET_VARS['slc']);
insert after:
$action = 'images';
this code
} else if ($action == 'media') {
// use media RSS template
$main_template = $media_template;
$sub_template = $media_sub_template;
insert after:
case 'images':
this code
case 'media':
insert before:
'author' => array(
this code
'enclosure_info' => ($row['image_thumb_file'] ? getimagesize(THUMB_PATH."/".$row['cat_id']."/".$row['image_thumb_file']) : array(0,0, "", "")),
'realimage' => get_rss_enclosure($row['image_media_file'], "media", $row['cat_id']),
'realimage_info' => getimagesize(MEDIA_PATH."/".$row['cat_id']."/".$row['image_media_file']),
insert after:
'item_enclosure_type' => '',
this code
'item_enclosure_width' => '',
'item_enclosure_height' => '',
'item_enclosure_info_width' => '',
'item_enclosure_info_height' => '',
'item_realimage' => false,
'item_realimage_url' => '',
'item_realimage_length' => '',
'item_realimage_type' => '',
'item_realimage_width' => '',
'item_realimage_height' => '',
'item_realimage_info_width' => '',
'item_realimage_info_height' => '',
insert after:
$tpl_vars['item_enclosure'] = true;
this code
// set thumbnail height/width
$tpl_vars['item_enclosure_width'] = $item['enclosure_info'][0];
$tpl_vars['item_enclosure_height'] = $item['enclosure_info'][1];
// have to %20 encode the URIs for RSS (the file path is probably ok, but what about other %s?
$tpl_vars['item_enclosure_url'] = str_replace(" ", "%20", $item['enclosure']['url']);
insert before:
$site_template->register_vars($tpl_vars);
this code
if ($action == 'media') {
// only need this if we're in the media template
if (@count($item['realimage']) > 0) {
$tpl_vars['item_realimage'] = true;
// set full image height/width
$tpl_vars['item_realimage_width'] = $item['realimage_info'][0];
$tpl_vars['item_realimage_height'] = $item['realimage_info'][1];
// have to %20 encode the URIs for RSS (the file path is probably ok, but what about other %s?
$tpl_vars['item_realimage_url'] = str_replace(" ", "%20", $item['realimage']['url']);
$tpl_vars['item_realimage_length'] = $item['realimage']['length'];
$tpl_vars['item_realimage_type'] = $item['realimage']['type'];
}
}
change:
$items .= $site_template->parse_template("rss_item");
to
$items .= $site_template->parse_template($sub_template);
categories.phpinsert before:
//-----------------------------------------------------
//--- Clickstream -------------------------------------
this code
//-----------------------------------------------------
//--- Slideshow ---------------------------------------
//-----------------------------------------------------
$mrss_url = $script_url."/rss.php?action=media&".URL_CAT_ID."=".$cat_id."&slc=".$num_rows_all;
$gslideshow_url = $script_url."/sshow.php?rssurl=".urlencode($mrss_url);
if ($num_rows_all > 0) {
$gslideshow = "<span class=\"slideshow\"><a href=\"#\" onClick=\"window.open('".$gslideshow_url."','_blank','toolbar=0, location=0, scrollbars=0, menuBar=0, width=500, height=520'); return(false)\">View Slideshow of Images</a></span>";
} else {
$gslideshow = " ";
}
$site_template->register_vars(array(
"gslideshow_url" => $gslideshow_url,
"gslideshow" => $gslideshow
));
categories.htmlchange:
{paging_stats}
<br />
<br />
to
<p>
{gslideshow}
</p>