Slideshow/Cooliris on keyword albums?

nameht

Joined: 2004-11-21
Posts: 47
Posted: Sat, 2009-05-30 21:16
suprsidr wrote:
New code update utilizes gallery's own slideshow module without need for my script(picLensRss.php):
Place this in gallery2/themes/your theme/templates/local/theme.tpl <- you may have to copy yours here.
Just above the </head>

{if $theme.pageType == 'album' && $theme.item.entityType == 'GalleryDynamicAlbum'}
    {assign var="separator" value=''}
    {assign var="itemString" value=''}
    {foreach from=$theme.children item=child}
    {if $itemString != ''}
    {assign var="separator" value=|}
    {/if}
    {assign var="itemString" value=$itemString$separator`$child.id`}
    {/foreach}
    {if $itemString}
    <link rel="alternate" type="application/rss+xml" title="Photo RSS" href="{g->url arg1="view=slideshow.SlideshowMediaRss" arg2="itemList=`$itemString`"}"/>
    {/if}
{/if}

Works for all dynamic albums including keyword and tag albums :)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

Hello,

I tried to use the above to activate slideshows in Tag albums, but nothing shows up?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2009-05-30 21:42
 
nameht

Joined: 2004-11-21
Posts: 47
Posted: Sat, 2009-05-30 22:29

oh ok, i was using a computer without cooliris installed, is it possible to add a view slideshow link that will work regardless of weather or not cooliris is installed?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2009-05-30 22:56
 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2009-05-31 13:52

Ok, took me 2 1/2 hours this morning to wrap my head around this one.
This adds our slideshow link to the $itemLinks array for any GalleryDynamicAlbum so no need to manually add your link.
add this to theme.tpl before the end of the head (</head>)

{if $theme.pageType == 'album' && $theme.item.entityType == 'GalleryDynamicAlbum'}
    {assign var="separator" value=''}
    {assign var="itemString" value=''}
    {foreach from=$theme.children item=child}
      {if $itemString != ''}{assign var="separator" value=|}{/if}
      {assign var="itemString" value=$itemString$separator`$child.id`}
    {/foreach}
    {if $itemString}
    {php}
      $script = sprintf(
            'var p=PicLensLite;'
            . 'p.setCallbacks({onNoPlugins:function(){location.href=\'%s\'}});'
            . 'p.setLiteURLs({swf:\'%s\'});'
            . 'p.start({feedUrl:\'%s\', guid:%d, pid:\'2PWfB4lurT4g\', delay:%s})',
            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.Slideshow",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.DownloadPicLens",'arg2' => "file=swf",'arg3' => "v=1.3.1.14221", 'forceDirect' => true, 'forceFullUrl' => true, 'htmlEntities' => false), $this),
            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.SlideshowMediaRss",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
            $this->_tpl_vars['itemString'], 10);
      $newLink = array('moduleId' => 'slideshow', 'text' => 'View Slideshow', 'script' => $script, 'options' => Array (), 'params' => array('view' => 'slideshow.Slideshow', 'itemList' => $this->_tpl_vars['itemString']));
      array_push($this->_tpl_vars['theme']['itemLinks'], $newLink);
    {/php}
      <link rel="alternate" type="application/rss+xml" title="Photo RSS" href="{g->url arg1="view=slideshow.SlideshowMediaRss" arg2="itemList=`$itemString`"}"/>
    {/if}
{/if}

your slideshow link in album.tpl and/or photo.tpl needs to look like:

{if (isset($links) || isset($theme.itemLinks))}
  {if !isset($links)}{assign var="links" value=$theme.itemLinks}{/if}
  {foreach from=$links item=itemLink}
    {if $itemLink.moduleId == "slideshow"}
      {g->itemLink link=$itemLink
        title="$itemLink.text" text="$itemLink.text" class="gbAdminLink gbLink-slideshow_Slideshow"}
    {/if}
  {/foreach}
{/if}

your theme may already have the foreach loop, so simply replace the slideshow link part.

enjoy :)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
nameht

Joined: 2004-11-21
Posts: 47
Posted: Mon, 2009-06-01 00:00

thanks suprsidr for all the help!!

one more question, is it possible to make the slideshow include all the images instead of just the one page?

if not I can just increase the number of images viewed on each page

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2009-06-01 01:10

Well, we don't always have $theme.allChildIds available, but this will check to see if we do:

	{if $theme.pageType == 'album' && $theme.item.entityType == 'GalleryDynamicAlbum'}
	    {assign var="separator" value=''}
	    {assign var="itemString" value=''}
	    {if isset($theme.allChildIds)}
	      {foreach from=$theme.allChildIds item=id}
	        {if $itemString != ''}{assign var="separator" value=|}{/if}
	        {assign var="itemString" value=$itemString$separator`$id`}
	      {/foreach}
	    {else}
	      {foreach from=$theme.children item=child}
	        {if $itemString != ''}{assign var="separator" value=|}{/if}
	        {assign var="itemString" value=$itemString$separator`$child.id`}
	      {/foreach}
	    {/if}
	    {if $itemString}
	    {php}
	      $script = sprintf(
	            'var p=PicLensLite;'
	            . 'p.setCallbacks({onNoPlugins:function(){location.href=\'%s\'}});'
	            . 'p.setLiteURLs({swf:\'%s\'});'
	            . 'p.start({feedUrl:\'%s\', guid:%d, pid:\'2PWfB4lurT4g\', delay:%s})',
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.Slideshow",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.DownloadPicLens",'arg2' => "file=swf",'arg3' => "v=1.3.1.14221", 'forceDirect' => true, 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.SlideshowMediaRss",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_tpl_vars['itemString'], 10);
	      $newLink = array('moduleId' => 'slideshow', 'text' => 'View Slideshow', 'script' => $script, 'options' => Array (), 'params' => array('view' => 'slideshow.Slideshow', 'itemList' => $this->_tpl_vars['itemString']));
	      array_push($this->_tpl_vars['theme']['itemLinks'], $newLink);
	    {/php}
	      <link rel="alternate" type="application/rss+xml" title="Photo RSS" href="{g->url arg1="view=slideshow.SlideshowMediaRss" arg2="itemList=`$itemString`"}"/>
	    {/if}
	{/if}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
nameht

Joined: 2004-11-21
Posts: 47
Posted: Mon, 2009-06-01 03:40

works great thanks!

 
bensgalery
bensgalery's picture

Joined: 2009-09-10
Posts: 21
Posted: Thu, 2009-12-03 16:56

Works great for me as well. Ran into few little issues:

theme.tpl:

Quote:
'var p=PicLensLite;'
. 'p.setCallbacks({onNoPlugins:function(){location.href=\'%s\'}});'
. 'p.setLiteURLs({swf:\'%s\'});'
. 'p.start({feedUrl:\'%s\', guid:%d, pid:\'2PWfB4lurT4g\', delay:%s})',

What is actually represented by %s ?
I am using your new Slideshow v.96 and have the delay set at 3 seconds. The above code does not pick up this value and Cooliris opens with setting 10 seconds. I got it my way by replacing the above %s by the delay I want i.e. 3.

Quote:
$newLink = array('moduleId' => 'slideshow', 'text' => 'View Slideshow', 'script' => $script, 'options' => Array (), 'params' => array('view' => 'slideshow.Slideshow', 'itemList' => $this->_tpl_vars['itemString']));

'text' => 'View Slideshow': what should this entry be to get the value translated to my language (Dutch). Again got it my way by replacing it by the translated value 'Diashow Weergeven'.

album.tpl:

Quote:
title="$itemLink.text" text="$itemLink.text" class="gbAdminLink gbLink-slideshow_Slideshow"}

Above gave wrong results in Carbon. Reinstated the original already present line and things work fine.

Quote:
title="`$itemLink.text`" text="" class=""}

Selecting a photo from a dynamic 'album' page will open this photo on a 'photo' page. When selecting 'View Slideshow' from this photo page, the slideshow presents all photo's which are in the folder of this current photo and not from the dynamic 'itemString'.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2009-12-04 04:33
$script = sprintf(
	            'var p=PicLensLite;'
	            . 'p.setCallbacks({onNoPlugins:function(){location.href=\'%s\'}});'
	            . 'p.setLiteURLs({swf:\'%s\'});'
	            . 'p.start({feedUrl:\'%s\', guid:%d, pid:\'2PWfB4lurT4g\', delay:%s})',
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.Slideshow",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.DownloadPicLens",'arg2' => "file=swf",'arg3' => "v=1.3.1.14221", 'forceDirect' => true, 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_reg_objects['g'][0]->url(array('arg1' => "view=slideshow.SlideshowMediaRss",'arg2' => "itemList=".($this->_tpl_vars['itemString']), 'forceFullUrl' => true, 'htmlEntities' => false), $this),
	            $this->_tpl_vars['itemString'], 10);

the 10 at the end of the code replaces the %s for the delay.
The slideshow module's delay variable is not available in these templates, you'd have to add it in theme.inc.

Quote:
'text' => 'View Slideshow': what should this entry be to get the value translated to my language (Dutch)

Normally the slideshow module would provide this translation, but its not involved in this function.

Quote:
When selecting 'View Slideshow' from this photo page, the slideshow presents all photo's which are in the folder of this current photo and not from the dynamic 'itemString'.

You are no longer in the dynamic album at this point.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
webmayin

Joined: 2005-10-16
Posts: 26
Posted: Thu, 2009-12-17 10:50

regarding your post from 05-31:
That works brilliantly for getting the slideshow link away from the sidebar. I have been trying to get rid of my sidebar forever, just to give more space to images.
http://dreadfulimagery.com/index.php?q=gallery&g2_itemId=324
I put your code just in the g->block type="core.ItemInfo"
I did change your code to fit:

Quote:
title="$itemLink.text" text="$itemLink.text"

to

Quote:
title="View Slideshow" text="View slideshow"

How can I apply the same View slideshow link to appear between album name and album size attributes, if I may be so bold as to ask? I have looked for hooks in all the other theme .tpl files.
Thank you for your help, I am grateful already.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2009-12-17 12:07
 
webmayin

Joined: 2005-10-16
Posts: 26
Posted: Fri, 2009-12-18 01:58

http://dreadfulimagery.com/index.php?q=gallery&g2_itemId=324
works fine, I guess because it's inside an album, and there's photos present
http://dreadfulimagery.com/index.php?q=gallery&g2_itemId=67
No link present, because there's no photos present.
It is a list of albums, and I was hoping to have a View link on each of them, one less click for users to the cooliris. Any ideas?