6 |
kaklik |
1 |
<?php
|
|
|
2 |
/*************************
|
|
|
3 |
Coppermine Photo Gallery
|
|
|
4 |
************************
|
|
|
5 |
Copyright (c) 2003-2005 Coppermine Dev Team
|
|
|
6 |
v1.1 originaly written by Gregory DEMAR
|
|
|
7 |
|
|
|
8 |
This program is free software; you can redistribute it and/or modify
|
|
|
9 |
it under the terms of the GNU General Public License as published by
|
|
|
10 |
the Free Software Foundation; either version 2 of the License, or
|
|
|
11 |
(at your option) any later version.
|
|
|
12 |
********************************************
|
|
|
13 |
Coppermine version: 1.3.3
|
|
|
14 |
$Source: /cvsroot/coppermine/stable/include/slideshow.inc.php,v $
|
|
|
15 |
$Revision: 1.9 $
|
|
|
16 |
$Author: gaugau $
|
|
|
17 |
$Date: 2005/04/19 03:17:11 $
|
|
|
18 |
**********************************************/
|
|
|
19 |
?>
|
|
|
20 |
|
|
|
21 |
<script language="JavaScript" type="text/JavaScript">
|
|
|
22 |
// (C) 2000 www.CodeLifter.com
|
|
|
23 |
// http://www.codelifter.com
|
|
|
24 |
// Free for all users, but leave in this header
|
|
|
25 |
// NS4-6,IE4-6
|
|
|
26 |
// Fade effect only in IE; degrades gracefully
|
|
|
27 |
|
|
|
28 |
// $Id: slideshow.inc.php,v 1.9 2005/04/19 03:17:11 gaugau Exp $
|
|
|
29 |
|
|
|
30 |
// Set slideShowSpeed (milliseconds)
|
|
|
31 |
var slideShowSpeed = <?php echo (int)$HTTP_GET_VARS['slideshow'] ?>
|
|
|
32 |
|
|
|
33 |
// Agent sniffer shamelessly 'stolen' from the excellent X library from cross-browser.com
|
|
|
34 |
var xOp7=false,xOp5or6=false,xIE4Up=false,xNN4=false,xUA=navigator.userAgent.toLowerCase();
|
|
|
35 |
if(window.opera){
|
|
|
36 |
xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);
|
|
|
37 |
if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);
|
|
|
38 |
}
|
|
|
39 |
else if(document.layers) xNN4=true;
|
|
|
40 |
else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;}
|
|
|
41 |
|
|
|
42 |
// Duration of crossfade (seconds)
|
|
|
43 |
var crossFadeDuration = 3
|
|
|
44 |
|
|
|
45 |
// Specify the image files
|
|
|
46 |
var Pic = new Array() // don't touch this
|
|
|
47 |
// to add more images, just continue
|
|
|
48 |
// the pattern, adding to the array below
|
|
|
49 |
<?php
|
|
|
50 |
$i = 0;
|
|
|
51 |
$j = 0;
|
|
|
52 |
$pid = (int)$HTTP_GET_VARS['pid'];
|
|
|
53 |
$start_img = '';
|
|
|
54 |
$pic_data = get_pic_data($HTTP_GET_VARS['album'], $pic_count, $album_name, -1, -1, false);
|
|
|
55 |
foreach ($pic_data as $picture) {
|
|
|
56 |
|
|
|
57 |
if($CONFIG['thumb_use']=='ht' && $picture['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
|
|
|
58 |
$condition = true;
|
|
|
59 |
}elseif($CONFIG['thumb_use']=='wd' && $picture['pwidth'] > $CONFIG['picture_width']){
|
|
|
60 |
$condition = true;
|
|
|
61 |
}elseif($CONFIG['thumb_use']=='any' && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width']){
|
|
|
62 |
$condition = true;
|
|
|
63 |
}else{
|
|
|
64 |
$condition = false;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
if (is_image($picture['filename'])) {
|
|
|
68 |
if ($CONFIG['make_intermediate'] && $condition ) {
|
|
|
69 |
$picture_url = get_pic_url($picture, 'normal');
|
|
|
70 |
} else {
|
|
|
71 |
$picture_url = get_pic_url($picture, 'fullsize');
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
echo "Pic[$i] = '" . $picture_url . "'\n";
|
|
|
75 |
if ($picture['pid'] == $pid) {
|
|
|
76 |
$j = $i;
|
|
|
77 |
$start_img = $picture_url;
|
|
|
78 |
}
|
|
|
79 |
$i++;
|
|
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
if (!$i) {
|
|
|
83 |
echo "Pic[0] = 'images/thumb_document.jpg'\n";
|
|
|
84 |
}
|
|
|
85 |
?>
|
|
|
86 |
|
|
|
87 |
var t
|
|
|
88 |
var j = <?php echo "$j\n" ?>
|
|
|
89 |
var p = Pic.length
|
|
|
90 |
var pos = j
|
|
|
91 |
|
|
|
92 |
var preLoad = new Array()
|
|
|
93 |
|
|
|
94 |
function preLoadPic(index)
|
|
|
95 |
{
|
|
|
96 |
if (Pic[index] != ''){
|
|
|
97 |
window.status='Loading : '+Pic[index]
|
|
|
98 |
preLoad[index] = new Image()
|
|
|
99 |
preLoad[index].src = Pic[index]
|
|
|
100 |
Pic[index] = ''
|
|
|
101 |
window.status=''
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
function runSlideShow(){
|
|
|
106 |
if (xIE4Up){
|
|
|
107 |
document.images.SlideShow.style.filter="blendTrans(duration=2)"
|
|
|
108 |
document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
|
|
|
109 |
document.images.SlideShow.filters.blendTrans.Apply()
|
|
|
110 |
}
|
|
|
111 |
document.images.SlideShow.src = preLoad[j].src
|
|
|
112 |
if (xIE4Up){
|
|
|
113 |
document.images.SlideShow.filters.blendTrans.Play()
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
pos = j
|
|
|
117 |
|
|
|
118 |
j = j + 1
|
|
|
119 |
if (j > (p-1)) j=0
|
|
|
120 |
t = setTimeout('runSlideShow()', slideShowSpeed)
|
|
|
121 |
preLoadPic(j)
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
function endSlideShow(){
|
|
|
125 |
self.document.location = 'displayimage.php?album=<?php echo isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : '';
|
|
|
126 |
echo isset($HTTP_GET_VARS['cat']) ? '&cat=' . $HTTP_GET_VARS['cat'] : '' ?>&pos='+pos
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
preLoadPic(j)
|
|
|
130 |
|
|
|
131 |
</script>
|