Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Slideshow feature in A::G



Nice!
Use r39 it works flawlessly, hehe.

Btw how do u make 5secs the default?
GallerySlideshowIntervals '5' ?


-----Original Message-----
From: Michael Legart [mailto:[email protected]] 
Sent: Wednesday, August 21, 2002 3:58 AM
To: [email protected]
Subject: Re: Slideshow feature in A::G

On Tue, Aug 20, 2002 at 11:53:20PM -0400, Charles Chao wrote:
> Mv *.tmpl to my templates directory.
> Edited http.conf and added  PerlSetVar   GallerySlideshowIntervals '3
5

Sorry about that, I forgot to add the new templates to the MANIFEST file
so they where missing in the distribution

Fixed in

http://svn.apachegallery.dk:8080/snapshots/Apache-Gallery-r39.tar.gz

could you try again?

Thanks,
Michael

> -----Original Message-----
> From: Michael Legart [mailto:[email protected]] 
> Sent: Tuesday, August 20, 2002 11:35 AM
> To: [email protected]
> Subject: Slideshow feature in A::G
> 
> Hello everybody
> 
> Someone suggested a slideshow feature in A::G which I think was a
> great idea.
> 
> I have done a little bit of hacking and did both some cleanup and
> a suggestion for a slideshow feature.
> 
> You can see it in action at
> 
> http://gallery.legart.dk/Test/IMG_2801.JPG?slideshow=5
> 
> The intervals that the user can select are configurable.
> 
> I'm not sure if it should work like this. Currently the slideshow
> stops if you change resolution or use the prev/next buttons. Another
> known bug is that you can only see the slideshow in the default 
> resolution.
> 
> Anyway, just checking if I am on the right track. What do you 
> think?
> 
> As you can see in the commit mail you have to update two
> old templates and install a couple of new ones.
> 
> The code can be downloaded at 
> 
> http://svn.apachegallery.dk:8080/snapshots/Apache-Gallery-r38.tar.gz
> 
> on this URL (http://svn.apachegallery.dk:8080/snapshots/) you
> will always be able to download the latest snapshot of Apache::Gallery
-
> a tarball gets created on each commit automaticly.
> 
> You can also make a checkout of the code directly from the server
> using a Subversion client (subversion.tigris.org)
> 
> The url for the HEAD version is
> http://svn.apachegallery.dk:8080/svn/gallery/trunk
> 
> Cheers,
> Michael
> 
> ----- Forwarded message from [email protected] -----
> 
> From: [email protected]
> Subject: rev 38 - in trunk: . lib/Apache templates
> To: [email protected]
> Date: Tue, 20 Aug 2002 17:11:36 +0200 (CEST)
> 
> Author: mil
> Date: 2002-08-20 17:11:36 +0200 (Tue, 20 Aug 2002)
> New Revision: 38
> 
> Added:
>    trunk/templates/interval.tpl
>    trunk/templates/intervalactive.tpl
>    trunk/templates/refresh.tpl
>    trunk/templates/scaleactive.tpl
>    trunk/templates/slideshowisoff.tpl
>    trunk/templates/slideshowoff.tpl
> Modified:
>    trunk/Changes
>    trunk/README
>    trunk/UPGRADE
>    trunk/lib/Apache/Gallery.pm
>    trunk/templates/layout.tpl
>    trunk/templates/showpicture.tpl
> Log:
> Did some codecleanup and added a slideshow feature. The slideshow
stuff
> is still experimental, it is just proof of concept. 
> 
> 
> Modified: trunk/lib/Apache/Gallery.pm
>
========================================================================
> ======
> --- trunk/lib/Apache/Gallery.pm	(original)
> +++ trunk/lib/Apache/Gallery.pm	Tue Aug 20 17:11:36 2002
> @@ -88,6 +88,7 @@
>  		);
>  
>  		$tpl->assign(TITLE => "Index of: ".$uri);
> +		$tpl->assign(META => " ");
>  
>  		unless (opendir (DIR, $filename)) {
>  			show_error ($r, $!, "Unable to access directory
> $filename: $!");
> @@ -269,15 +270,22 @@
>  		my $tpl = new
> CGI::FastTemplate($r->dir_config('GalleryTemplateDir'));
>  
>  		$tpl->define(
> -			layout      => 'layout.tpl',
> -			picture     => 'showpicture.tpl',
> -			navpicture  => 'navpicture.tpl',
> -			info        => 'info.tpl',
> -			scale       => 'scale.tpl',
> -			orig        => 'orig.tpl'
> +			layout         => 'layout.tpl',
> +			picture        => 'showpicture.tpl',
> +			navpicture     => 'navpicture.tpl',
> +			info           => 'info.tpl',
> +			scale          => 'scale.tpl',
> +			scaleactive    => 'scaleactive.tpl',
> +			orig           => 'orig.tpl',
> +			refresh        => 'refresh.tpl',
> +			interval       => 'interval.tpl',
> +			intervalactive => 'intervalactive.tpl',
> +			slideshowisoff => 'slideshowisoff.tpl',
> +			slideshowoff   => 'slideshowoff.tpl'
>  		);
>  
>  		$tpl->assign(TITLE => "Viewing ".$r->uri()." at
> $image_width x $height");
> +		$tpl->assign(META => " ");
>  		$tpl->assign(RESOLUTION => "$image_width x $height");
>  		$tpl->assign(MENU => generate_menu($r));
>  		$tpl->assign(SRC => ".cache/".$cached);
> @@ -292,13 +300,16 @@
>  		@pictures = sort @pictures;
>  
>  		$tpl->assign(TOTAL => scalar @pictures);
> -		
> +
> +		my $prevpicture;
> +		my $nextpicture;
> +	
>  		for (my $i=0; $i <= $#pictures; $i++) {
>  			if ($pictures[$i] eq $picfilename) {
>  
>  				$tpl->assign(NUMBER => $i+1);
>  
> -				my $prevpicture = $pictures[$i-1];
> +				$prevpicture = $pictures[$i-1];
>  				my $displayprev = ($i>0 ? 1 : 0);
>  
>  				if
> ($r->dir_config("GalleryWrapNavigation")) {
> @@ -320,7 +331,7 @@
>  					$tpl->assign(BACK => "&nbsp");
>  				}
>  
> -				my $nextpicture = $pictures[$i+1];
> +				$nextpicture = $pictures[$i+1];
>  				if
> ($r->dir_config("GalleryWrapNavigation")) {
>  					$nextpicture = $pictures[$i ==
> $#pictures ? 0 : $i+1];
>  				}	
> @@ -373,7 +384,12 @@
>  				$tpl->assign(IMAGEURI =>
> uri_escape($r->uri(), $escape_rule));
>  				$tpl->assign(SIZE     => $size);
>  				$tpl->assign(WIDTH    => $size);
> +				if ($width == $size) {
> +					$tpl->parse(SIZES =>
> '.scaleactive');
> +				}
> +				else {
>  				$tpl->parse(SIZES => '.scale');
> +				}
>  			}
>  		}
>  
> @@ -382,6 +398,35 @@
>  			$tpl->parse(SIZES => '.orig');
>  		}
>  
> +		my @slideshow_intervals = split (/ /,
> $r->dir_config('GallerySlideshowIntervals') ?
> $r->dir_config('GallerySlideshowIntervals') : '3 5 10 15 30');
> +		foreach my $interval (@slideshow_intervals) {
> +			$tpl->assign(IMAGEURI => uri_escape($r->uri(),
> $escape_rule));
> +			$tpl->assign(SECONDS => $interval);
> +			if ($apr->param('slideshow') &&
> $apr->param('slideshow') == $interval and $nextpicture) {
> +				$tpl->parse(SLIDESHOW =>
> '.intervalactive');
> +			}
> +			else {
> +				$tpl->parse(SLIDESHOW => '.interval');
> +			}
> +		}
> +
> +		if ($apr->param('slideshow') and $nextpicture) {
> +
> +			$tpl->parse(SLIDESHOW => '.slideshowoff');
> +
> +			unless ((grep $apr->param('slideshow') == $_,
> @slideshow_intervals)) {
> +				show_error($r, "Invalid interval",
> $apr->param('slideshow')." is not an allowed interval.");
> +				return OK;
> +			}
> +
> +			$tpl->assign(INTERVAL =>
> $apr->param('slideshow'));
> +			$tpl->parse(META => '.refresh');
> +
> +		}
> +		else {
> +			$tpl->parse(SLIDESHOW => '.slideshowisoff');
> +		}
> +
>  		$tpl->parse("MAIN", ["picture", "layout"]);
>  		my $content = $tpl->fetch("MAIN");
>  
> @@ -650,7 +695,6 @@
>  
>  	$r->print(${$content});
>  
> -	return OK;
>  }
>  
>  sub generate_menu {
> @@ -858,6 +902,11 @@
>  resizing or putting the CopyrightImage on it.
>  
>  Set to 1 or 0, default is 0
> +
> +=item B<GallerySlideshowIntervals>
> +
> +With this option you can configure which intervals can be selected
for
> +a slideshow. The default is '3 5 10 15 30'
>  
>  =back
>  
> 
> Modified: trunk/UPGRADE
>
========================================================================
> ======
> --- trunk/UPGRADE	(original)
> +++ trunk/UPGRADE	Tue Aug 20 17:11:36 2002
> @@ -1,6 +1,18 @@
>  # $Author$ $Rev$
>  # $Date$
>  
> +For users upgrading from 0.4 to devel
> +
> +Remember to update the following templates:
> +templates/interval.tpl
> +templates/intervalactive.tpl
> +templates/layout.tpl
> +templates/refresh.tpl
> +templates/scaleactive.tpl
> +templates/showpicture.tpl
> +templates/slideshowisoff.tpl
> +templates/slideshowoff.tpl
> +
>  For users upgrading from 0.3 to 0.4:
>  
>  Two new options have been added, they are both optional:
> 
> Modified: trunk/Changes
>
========================================================================
> ======
> --- trunk/Changes	(original)
> +++ trunk/Changes	Tue Aug 20 17:11:36 2002
> @@ -3,6 +3,9 @@
>  
>  Revision history for Perl extension Apache::Gallery.
>  
> +	- Added slideshow feature (Me)	
> +	- Code cleanup (Me)
> +
>  0.4.1 Sun Aug 11 17:48:09 CEST 2002
>  
>  	- URI Escape image URL in the size selection URLs. (Me)
> 
> Modified: trunk/README
>
========================================================================
> ======
> --- trunk/README	(original)
> +++ trunk/README	Tue Aug 20 17:11:36 2002
> @@ -1,6 +1,3 @@
> -$Author$ $Rev$
> -$Date$
> -
>  NAME
>      Apache::Gallery - mod_perl handler to create an image gallery
>  
> @@ -59,7 +56,7 @@
>          Defines which widths images can be scaled to. Images cannot
be
>          scaled to other widths than the ones you define with this
> option.
>  
> -        The default is '640 1024 1600 2272'
> +        The default is '640 800 1024 1600'
>  
>      GalleryThumbnailSize
>          Defines the width and height of the thumbnail images.
> @@ -84,6 +81,10 @@
>  
>          Set to 1 or 0, default is 0
>  
> +    GallerySlideshowIntervals
> +        With this option you can configure which intervals can be
> selected
> +        for a slideshow. The default is '3 5 10 15 30'
> +
>  FEATURES
>      Rotate images
>          Pictures can be rotated on the fly without modifying the
> original
> @@ -116,11 +117,18 @@
>      Apache::Request
>      URI::Escape
>      Image::Info
> +    Image::Size
>      CGI::FastTemplate
>      Inline::C
>      X11 libraries (ie, XFree86)
>      Imlib2 Remember the -dev package when using rpm, deb or other
> package
>      formats!
> +BUGS
> +    Fatal errors are showed on a page with a HTTP OK return code.
This
> is
> +    because Internet Explorer will show it's own error page
otherwise.
> Is it
> +    possible to force IE to show our custom errormessage even when
> returning
> +    HTTP status code 500?
> +
>  AUTHOR
>      Michael Legart <[email protected]>
>  
> @@ -137,10 +145,11 @@
>  
>  THANKS
>      Thanks to Thomas Kjaer for templates and design of
> -    http://apachegallery.dk and thanks to Thomas Eibner for patches.
> +    http://apachegallery.dk Thanks to Thomas Eibner and other for
> patches.
> +    (See the Changes file)
>  
>  SEE ALSO
>      the perl manpage, the mod_perl manpage, the Apache::Request
> manpage, the
> -    Inline::C manpage, the CGI::FastTemplate manpage, and the
> Image::Info
> -    manpage.
> +    Inline::C manpage, the CGI::FastTemplate manpage, the Image::Info
> +    manpage, and the Image::Size manpage.
>  
> 
> Added: trunk/templates/scaleactive.tpl
>
========================================================================
> ======
> --- trunk/templates/scaleactive.tpl	(original)
> +++ trunk/templates/scaleactive.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +$SIZE
> 
> Added: trunk/templates/interval.tpl
>
========================================================================
> ======
> --- trunk/templates/interval.tpl	(original)
> +++ trunk/templates/interval.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +<a href="$IMAGEURI?slideshow=$SECONDS">$SECONDS</a>
> 
> Added: trunk/templates/slideshowisoff.tpl
>
========================================================================
> ======
> --- trunk/templates/slideshowisoff.tpl	(original)
> +++ trunk/templates/slideshowisoff.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +Off
> 
> Added: trunk/templates/slideshowoff.tpl
>
========================================================================
> ======
> --- trunk/templates/slideshowoff.tpl	(original)
> +++ trunk/templates/slideshowoff.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +<a href="$IMAGEURI">Off</a>
> 
> Added: trunk/templates/refresh.tpl
>
========================================================================
> ======
> --- trunk/templates/refresh.tpl	(original)
> +++ trunk/templates/refresh.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +<meta http-equiv="refresh" content="$INTERVAL;
> url=$URL?slideshow=$INTERVAL" />
> 
> Modified: trunk/templates/showpicture.tpl
>
========================================================================
> ======
> --- trunk/templates/showpicture.tpl	(original)
> +++ trunk/templates/showpicture.tpl	Tue Aug 20 17:11:36 2002
> @@ -9,7 +9,8 @@
>  						<center class="nav">
>  						Viewing picture $NUMBER
> of $TOTAL at $RESOLUTION pixels<br>
>              <img src="$SRC"><br>
> -            Size [ $SIZES ]
> +            Size [ $SIZES ]<br>
> +						Slideshow [ $SLIDESHOW ]
>            </center>
>          </td>
>        </tr>
> @@ -32,7 +33,7 @@
>  	  <tr>
>  	  	<td colspan="3">
>  		  <div id="gallery">
> -		    Indexed by <a
> href="http://apachegallery.dk";>Apache::Gallery</a> - Copyright &copy;
> 2001 Michael Legart - <a href="http://www.hestdesign.com/";>Hest
> Design!</a>
> +		    Indexed by <a
> href="http://apachegallery.dk";>Apache::Gallery</a> - Copyright &copy;
> 2001-2002 Michael Legart - <a href="http://www.hestdesign.com/";>Hest
> Design!</a>
>  		  </div>
>  		</td>
>  	  </tr>
> 
> Modified: trunk/templates/layout.tpl
>
========================================================================
> ======
> --- trunk/templates/layout.tpl	(original)
> +++ trunk/templates/layout.tpl	Tue Aug 20 17:11:36 2002
> @@ -5,6 +5,7 @@
>  <head>
>  	<title>$TITLE</title>
>  	<link rel="stylesheet" href="/gallery.css">
> +	$META
>  </head>
>  
>  <body>
> 
> Added: trunk/templates/intervalactive.tpl
>
========================================================================
> ======
> --- trunk/templates/intervalactive.tpl	(original)
> +++ trunk/templates/intervalactive.tpl	Tue Aug 20 17:11:36 2002
> @@ -0,0 +1 @@
> +$SECONDS
> 
> ----- End forwarded message -----