4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 30, 2010, 04:43:24 AM

Login with username, password and session length
Search:     Advanced search
Follow 4images on twitter: Click here to follow!
Translate this page with google
=>
 Translate this page with Google =>
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Requests & Discussions) (Moderators: mawenzi, Rembrandt)
| | |-+  slideshow MOD that uses the Google AJAX RSS Slideshow API
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: slideshow MOD that uses the Google AJAX RSS Slideshow API  (Read 3104 times)
Chris4A
Pre-Newbie

Offline Offline

Posts: 2

Thank You
-Given: 0
-Receive: 0


View Profile
« on: February 18, 2008, 04:38:17 AM »

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.html

To 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 key
templates/default/mrss.xml
templates/default/mrss_item.xml
--> download zip


rss.php
insert after:
1
$main_template = 'rss';
this code
1
2
3
$sub_template = "rss_item";
$media_template = 'mrss';
$media_sub_template = "mrss_item";

change:
1
@define('RSS_MAX_ITEMS', 30);
to
1
@define('RSS_MAX_ITEMS', 100);

change:
1
if (isset($HTTP_GET_VARS['items']) || isset($HTTP_POST_VARS['items'])) {
to
1
2
3
4
// # 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:
1
  $action = 'images';
this code
1
2
3
4
} else if ($action == 'media') {
  // use media RSS template
  $main_template = $media_template;
  $sub_template = $media_sub_template;

insert after:
1
  case 'images':
this code
1
  case 'media':

insert before:
1
        'author' => array(
this code
1
2
3
        '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:
1
    'item_enclosure_type' => '',
this code
1
2
3
4
5
6
7
8
9
10
11
12
    '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:
1
    $tpl_vars['item_enclosure'] = true;
this code
1
2
3
4
5
// 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:
1
  $site_template->register_vars($tpl_vars);
this code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  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:
1
  $items .= $site_template->parse_template("rss_item");
to
1
  $items .= $site_template->parse_template($sub_template);



categories.php
insert before:
1
2
//-----------------------------------------------------
//--- Clickstream -------------------------------------
this code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//-----------------------------------------------------
//--- 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 = "&nbsp;";
}

$site_template->register_vars(array(
  "gslideshow_url" => $gslideshow_url,
  "gslideshow"   => $gslideshow
));



categories.html
change:
1
2
3
  {paging_stats}
  <br />
  <br />
to
1
2
3
  <p>
  {gslideshow}
  </p>
Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2329

Thank You
-Given: 0
-Receive: 1


View Profile
« Reply #1 on: February 18, 2008, 05:02:05 AM »

Purfect code structure. Wink

Two lines:

1
'enclosure_info' => ($row['image_thumb_file'] ? getimagesize(THUMB_PATH."/".$row['cat_id']."/".$row['image_thumb_file']) : array(0,0, "", "")),

for this:

1
'enclosure_info' => (isset($row['image_thumb_file']) && !empty($row['image_thumb_file'])) ? getimagesize(THUMB_PATH."/".$row['cat_id']."/".get_basefile(stripslashes(trim($row['image_thumb_file'])))) : array(0,0, "", "")),

This:

1
2
3
4
$site_template->register_vars(array(
  "gslideshow_url" => $gslideshow_url,
  "gslideshow"   => $gslideshow
));

for:

1
2
3
4
$site_template->register_vars(array(
  "gslideshow_url" => (isset($gslideshow_url) && !empty($gslideshow_url)) ? $gslideshow_url : "",
  "gslideshow"   => (isset($gslideshow) && !empty($gslideshow)) ? $gslideshow : ""
));

Wink
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
Chris4A
Pre-Newbie

Offline Offline

Posts: 2

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: February 18, 2008, 05:18:22 AM »

I forgot to mention that this was developed at tested with 4images v1.7.4-1.7.6
Logged
WVHeliClub
Pre-Newbie

Offline Offline

Posts: 3

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #3 on: July 07, 2009, 05:11:54 AM »

Is there a way to update the rss feed to the "media rss 2.0" without the google ajax api included?


                                                                                                 thanks in advance
Logged
GaYan
Sr. Member
****
Offline Offline

Posts: 293

Thank You
-Given: 6
-Receive: 11

♫ | G2 | ♫


View Profile WWW
« Reply #4 on: July 07, 2009, 02:12:44 PM »

How can i see the Slide show ???  Embarassed

i tired ... but only image names appearead... i need serious hel ove hre...

thanks

Gayan !
Logged

G2 DesignLabs - Creative web Design And Development - www.G2Designlabs.com
  • Developing Flash Apps [ Games , Applications , Web Sites , etc .... ]
  • 4image Templates ( css or fully flash ) [ Fully Flash or css 4image designing ]
  • Any PSD to 4image template [ Convert Your Psd to a 4image Template ]
  • Digital Video Production [ 3D And Visual FX , Digital Promoz & etc .. ]
  • Graphic Designing [ PS . AI . MaYa ]
Signature stolen from Nicky Very Happy
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos