Slideshow customization: no loop and showing "image x of total"

peter_k

Joined: 2005-09-15
Posts: 134
Posted: Tue, 2005-09-20 21:38

The default setting of slideshow seems to be an automatic loop of all images in an album. I would like to:
- disable loop by default, so that all images in an album are shown only once (e.g. when user starts slideshow at image 4, all images will be shown until the end, and then back from the beginning until image 3;
- show checkbox to enable slideshow loop;
- show the "status" of the slideshow in the slideshow window, e.g. "image 3 of 20" or something. I tried to put the "navigator" block in the slideshow.tpl, but that didn't work.

Thanks for any hints ...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-09-20 21:46

on http://codex.gallery2.org/index.php/Gallery2:How_Tos there is linked a related howto.

 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Tue, 2005-09-20 22:09

In addition to valiant's direction, try this site's new Feature Voting system to vote for the "[G2] Set general slideshow-options in siteadministration" if you'd like to see the ability to control looping in your Gallery added to the admin interface.

Not that I'm trying to influence voting :-)

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Wed, 2005-09-21 06:34
valiant wrote:
on http://codex.gallery2.org/index.php/Gallery2:How_Tos there is linked a related howto.

Thanks, but this topics only discuss setting the timer delay and the image size (and these topics did help me in doing that!!).
My question was about the default loop setting and adding the "current" bit of the navigator in slideshow.

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Mon, 2005-09-26 14:01

Since this functionality didn't seem to exist, I modified the slideshow module with additional functionality:

- by default, "loop" is disabled. A user starting slideshow at image 5, will be shown all images in the album, going back to the beginning, and ending again at picture 5.
- a checkbox "loop" is added, where user can enable the loop function. When unchecked again (after all images in album have been shown), the slideshow will stop at the current image.
- the "navigator" is added: "< previous" will do exactly that ("back one image" in old slidshow); "next >" will allow user to go quickly to the next image; and user will always see where she is in the album (e.g. 5 of 23);
- slideshow is integrated in overall site template;
- breadcrumb is added on slideshow page;
- identical lay-out / look & feel between photo page and slideshow page;
- I disabled the fancy transitions (for some browsers only), which only distract from the photo.

To see it in action: http://www.mir-w-art.org/photos/v/
(it's in french, but straigthforward to navigate; only this: "Lancer un diaporama" = "launch slideshow")

If anybody is interested, I can post the updated slideshow.tpl and .css (based on Siriux) somewhere (where?).

[edit]links added in post below

 
Warren
Warren's picture

Joined: 2002-07-24
Posts: 794
Posted: Mon, 2005-09-26 16:11

Seems to loop even not checking the box with Firefox.

Warren~

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Mon, 2005-09-26 17:10

Warren, thanks for confirming this problem. I was already working on it, and I think this happened because when the first loop ends, it takes more time loading the new page (the photo.tpl one) than continuing the script... This only happens when you choose a "high speed". For me, the problem only occured at 1 second. Can you let me know at what slideshow speed this happened for you?
Anyway, I modified the script (after the call to the new page, I immediately set the speed @ 10 seconds, this should give the webserver & browser "enough" time to load the new page), and now it's working (FF & IE6). Could you also test again? Thanks.

 
Warren
Warren's picture

Joined: 2002-07-24
Posts: 794
Posted: Mon, 2005-09-26 17:29

Yes it tested good this time! I tested with a different album too and both tests were with the default 3 second rotation. Looks great! Looking forward to getting this going.

Warren~

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Tue, 2005-09-27 12:13

thanks. i'll clean up the code a bit and attach the files later.

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Thu, 2005-09-29 17:41

Attached are the modified .tpl files of the customized slideshow module as developed for http://www.mir-w-art.org/photos/v/

Some of the labels are written in French because I have no experience in updating translation files (.po and .mo), but it's easy to modify them in the .tpl files.
Page lay-out is mostly driven by the theme.css file; the theme used on mir-w-art.org is mwg2, which is a variation of siriux, therefore not officially published (but willing to share on request).

 
boaly

Joined: 2003-07-23
Posts: 12
Posted: Thu, 2005-09-29 21:31

hiya,

this is exactly what I'm looking to do - your zip file appears to be corrupt though

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Fri, 2005-09-30 10:37

I re-tried the zip file and it worked (both 7zip and XP).
Anyway, this are links to the files on my server:

http://www.mir-w-art.org/temp/Slideshow.tpl
http://www.mir-w-art.org/temp/Header.tpl

If you like them, please help me in pushing a feature request (that I'd love to see in the next G2 version) on the priority list. A description and ref n° in this post: http://gallery.menalto.com/node/37280#comment-137389

 
boaly

Joined: 2003-07-23
Posts: 12
Posted: Fri, 2005-09-30 16:55

cheers - duly voted for
could I ask how you acheived your "Lancer un diaporama" link without showing any of the links to the other blocks ith the same user permissions

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Mon, 2005-10-03 09:05

There are basically only 2 users: myself (admin) and the rest of the world. To prevent that I have all the other links when I'm logged in, I put the itemlinks call within an if statement:

{if !$user.isRegisteredUser}
*display Item links*
{/if}

For the "rest of the world" (users that are nog logged in), there are no other blocks enabled, hence the only link I have in the itemlinks list is the slideshow, so it is not an issue for me, but, I agree, not very "clean".

I know others on the forum have asked (your own post here, another one here) this question (simple link to slideshow), but I have not seen an answer until now. To make my code a bit cleaner (maybe later I want to activate some other links as well) I tried to add an if statement that tests ($item.moduleId=slideshow), but I couldn't get the syntax right, so I left it as it is.

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Mon, 2005-10-03 09:22

after some more trying, I found the right syntax to only display the "View slideshow" link:

{if ($theme.itemLinks)}
	{* Item Links (slideshow only) *}
	{foreach from=$theme.itemLinks item=item}
	{if $item.moduleId == "slideshow"}
	    <a href="{g->url params=$item.params}" class="slideshowlink">{$item.text}</a>
	{/if}
	{/foreach}
{/if}
 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Tue, 2005-10-04 16:37

Which file?

grep -r "$theme.itemLinks" matrix/
matrix/templates/album.tpl: {g->block type="core.ItemLinks" item=$child links=$child.itemLinks}
matrix/theme.inc: 'systemLinks', 'itemLinks', 'itemSummaries', 'permissions',
matrix/theme.inc: $dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions',
matrix/theme.inc: 'itemLinksDetailed', 'itemNavigator', 'imageViews');

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Tue, 2005-10-04 17:26

short answer: in the album.tpl and/or photo.tpl files.

(certainly not in any .inc file).

longer answer: it depends on the theme and on what modifications you made already. Wherever the Item Links are shown, you can put the call in this if-statement. But watch out, when logged in, you need somewhere a full list of all the Itemlinks ("edit album", "delete photo", ...). If there is only one call to the itemlinks, you can do something like this:

 
{if $user.isRegisteredUser}
	{g->theme include="itemLinks.tpl"}
{else}
   {if ($theme.itemLinks)}
	{* Item Links (slideshow only) *}
	{foreach from=$theme.itemLinks item=item}
	{if $item.moduleId == "slideshow"}
	    <a href="{g->url params=$item.params}" class="slideshowlink">{$item.text}</a>
	{/if}
	{/foreach}
   {/if}
{/if}
 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Tue, 2005-10-04 22:04

I want to modify the matrix-theme and/or the hybrid-theme and the slideshow link should not displayed, if only albums and no pictures exist in this level.

Could you please tell me, if the above code is ok to put in album.tpl? I don't think so, I don't want to make no difference between a logged-in user or none. It doesn't make sense for a logged-in user to click on the slideshow-link to get an error-message later, if no photos are present.

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Wed, 2005-10-05 08:47

pinguin, with matrix and hybrid theme, you'll have to edit (or put copy in /local) the ItemLinks.tpl file you can find in \modules\core\templates\blocks\
(and not the album.tpl file; that's only in case you use siriux theme and its derivatives)

I modified the file to not show the slideshow link when there are no photos in the album, but only sub-albums.
you can find the file here.

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Wed, 2005-10-05 11:08

peter_k thanks a lot. I don't understand why I couldn't open "modules/core" with Konqueror (fish://) but with the bash. Anyway I edited the file with vi.

drwxr-xr-x 8 user group 4096 Sep 29 13:16 core

SLideshow has gone, but a line remains. Probably this occurs, since I edited some part of matrix and don't know what it was. I remember only, that the description width became larger afterwards. It could be that the line is part of the sidebar. Does a "top-line" in the sidebar exist?

I mean there is the logo an top. Then there are 2 lines, in between there is the top level description and below there is a 3rd line. I don't want to post the url of the album here, since it is under construction. But if you want I can send you a private message, to have a look at it.

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Wed, 2005-10-05 11:19

In the meantime I found out, that there is a difference between a logged in user and none. If a user is logged in, it is the line under comment and other editing tasks on the left side. If no user is logged in, all "links" on the left side are gone, but the line stays.

 
molotov69

Joined: 2005-10-09
Posts: 8
Posted: Sun, 2005-10-09 22:36

peter_k,
I've replaced my ItemLinks.tpl with yours but the "View Slideshow (Fullscreen)" still shows up. Do you have another snippet of code we can add to solve this?

Thanks

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Mon, 2005-10-10 10:29

well, this only works for the normal slideshow module, not the fullscreen version (which I don't have installed). you'll have to check what the moduleId is of that module (you'll find this if you switch on the buffered debug mode), and change this line of code:

	{if $link.moduleId == "slideshow"}

into something like this:

	{if ($link.moduleId == "slideshow") || ($link.moduleId == "__fullscreenslideshow__")}

and replace __fullscreenslideshow__ with the real moduleId.

 
molotov69

Joined: 2005-10-09
Posts: 8
Posted: Mon, 2005-10-10 14:40

Thanks peter_k! It worked using {if ($link.moduleId == "slideshow") || ($link.moduleId == "slideshowapplet")}

Now I'll have to figure out how to get rid of that extra line it draws in the sidebar...

 
rick7

Joined: 2005-03-02
Posts: 168
Posted: Tue, 2006-01-03 22:59

Hi Peter -- thanks VERY much for this slideshow module which I've wished for for some time. A question: when I call the slideshow from either the photo page or the album page and I let it terminate naturally (not clicking STOP), then after the last image displays it returns to the root album (Gallery front page) rather than either the album or the photo. Do you get the same results? I'm using the G1 theme if that makes any difference.

 
peter_k

Joined: 2005-09-15
Posts: 134
Posted: Wed, 2006-01-04 09:30

Nick, glad you liked it.
I don't know why it goes back to the root page. (you are using G2 right? just with the G1 *theme* ?)
Tried mine on FF & IE6, and it works as intended: the slideshow stops at the same photo that it started with when you let it terminate naturally.

You can read through this post to get some more info on what the module does when you click on "stop", but not sure it's relevant for your problem...

I looked again through the slideshow.tpl file to see where it can go wrong. The return page after the slideshow terminates is defined by this statement (in the "else" in the goto_next_photo function):

location.href={/literal}
"{g->url arg1="view=core.ShowItem" arg2="itemId=`$SlideShow.itemList[$SlideShow.start].id`"}"
{literal}

You can start with looking into the variables in the debugging window why this doesn't bring you back to the photo, but to the G2 start page. I guess this is a G2 default when there is an error in the g->url call?

Good luck !

 
DNewfield

Joined: 2006-03-09
Posts: 2
Posted: Thu, 2006-03-09 19:06

Since Gallery2 changed the way those links are included (they're just a block as far as the theme's template is concerned), here's a modification to the slideshow code that does the same thing:

Index: module.inc
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/slideshow/module.inc,v
retrieving revision 1.36
diff -r1.36 module.inc
65a66,72
> $containsNonAlbums = false;
> foreach ($items as $item) {
> if (!$item->getCanContainChildren()) {
> $containsNonAlbums = true;
> break;
> }
> }
68c75
< if (isset($wantsDetailedLinks[$itemId])) {
---
> if (isset($wantsDetailedLinks[$itemId]) && $containsNonAlbums) {

 
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Fri, 2006-03-17 23:42

1st problem:
i don´t know why that is, but when i change just a thingy like the french language peter_k included in his really really great slideshow template my slideshow produces errors like not showing ":" or showing strange dots instead of the photo slideshow count . this is due to encoding of firefox which automatically switches to utf8 in slideshow. when not changing anything this doesn´t happen!!!!????
any similar errors around?

2nd problem:
when i try to comment out the showing of the date in the navbar2 on the bottom of the slideshow the numbers in "1 de 23" in the navbar one also disappear!! what to do about it?
!!!
----------------------------------
(both solved with a lot of fantasy and copy and paste trying around- the tpl file now looks like a battle field though :-))
----------------------------------
!!!

ffaabbiiaann.de/gallery

cheers
fabs

p.s.
thank peter! exactly what is missing is slideshow customization in admin area!!!

 
fabs
fabs's picture

Joined: 2004-05-10
Posts: 171
Posted: Fri, 2006-03-17 23:52

anybody managed to change the language files for this really great and needed modification yet? don´t ask me.. i have no idea :(
tanks a lot peter_k

 
Ammo

Joined: 2006-03-23
Posts: 51
Posted: Fri, 2006-03-24 23:19

I translated the files peter_k created into English (see attached zip). They're working great on my site (using Gallery 2), however I discovered that some extra customization is needed in the slider theme to be sure that the "slideshow" button (bottom left) is set on the default speed you want.
Don't forget to change the text underneath title in "header.tpl" so that it corresponds to your site!

 
randomly

Joined: 2006-07-06
Posts: 13
Posted: Wed, 2006-07-19 09:54

I start using Gallery 2 nowadays and find it great. However, I want to modify the NavBar for the photo page such that it has the form

<left>First Previous</left> <middle>Slideshow</middle> <right>Next Last</right>

and I need help on that. Anybody helps me to make such a modification? Thank you.

Currently, I am using the matrix theme, but I believe that the modification can be done similarly for other themes as well.

 
randomly

Joined: 2006-07-06
Posts: 13
Posted: Wed, 2006-07-19 10:01

Also I want to prevent slideshow to start a new window/tab.

Thank

 
shivaya

Joined: 2006-12-22
Posts: 132
Posted: Sun, 2007-05-20 02:45
DNewfield wrote:
Since Gallery2 changed the way those links are included (they're just a block as far as the theme's template is concerned), here's a modification to the slideshow code that does the same thing:

Index: module.inc
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/slideshow/module.inc,v
retrieving revision 1.36
diff -r1.36 module.inc
65a66,72
> $containsNonAlbums = false;
> foreach ($items as $item) {
> if (!$item->getCanContainChildren()) {
> $containsNonAlbums = true;
> break;
> }
> }
68c75
< if (isset($wantsDetailedLinks[$itemId])) {
---
> if (isset($wantsDetailedLinks[$itemId]) && $containsNonAlbums) {

Ok, works for me on gallery 2.2.1 :)
but only works for the normal slideshow

This patch doesn't works with the module slideshowapplet :(
why ?

 
shivaya

Joined: 2006-12-22
Posts: 132
Posted: Sun, 2007-05-20 03:03

Ok, This patch works with the module slideshowapplet too
I had a problem of cache, sorry

Thanks ;)

 
djpumpkin

Joined: 2006-12-06
Posts: 135
Posted: Sat, 2007-11-24 16:18
Quote:
I modified the file to not show the slideshow link when there are no photos in the album, but only sub-albums.
you can find the file here.

This isn't working for me - I'm using Gallery version = 2.3-svn core 1.2.24
I guess things have changed too much.
Any ideas?