-
Notifications
You must be signed in to change notification settings - Fork 3
/
LyiightBox2.php
executable file
·66 lines (56 loc) · 1.81 KB
/
LyiightBox2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/* @todo use __DIR__ if php5.3 */
include_once dirname(__FILE__) . '/ConfigWidget.php';
/**
* LyiightBox2 class file.
*
* @author Simone Gentili <[email protected]>
* @version 1.1
*/
/**
* This widget encapsulates the LightBox2 script for popup images.
*
* ({@link https://github.com/sensorario/lyiightbox}).
*
* @author Simone Gentili <[email protected]>
*/
class LyiightBox2 extends ConfigWidget {
public $thumbnail = '';
public $image = '';
public $title = 'image';
public $group = 'default';
public $visible = true;
public function __construct() {
parent::__construct();
}
private function printImage() {
return $this->visible ? '<img src="'
. $this->thumbnail
. '" border="0" />' : '';
}
private function printLink() {
echo '<a '
. 'href="' . $this->image . '" '
. 'rel="lightbox[_' . $this->group . ']" '
. 'title="' . $this->title . '"'
. '>'
. $this->printImage()
. '</a>';
}
public function init() {
parent::config();
$this->printLink();
}
public static function thumb(Galleryii $galleryii, $image, $width = 120) {
echo "<div style=\"width: ".($width+3)."px; height: ".($width+30+3)."px; margin: 3px; border: #ccc 1px solid; float: left; \">";
echo "<div style=\"width: $width; height: $width; margin: 3px; border: #ccc 1px solid;\">";
echo '<a '
. 'href="' . "{$galleryii->rootFolder}{$galleryii->baseFolder}{$galleryii->images}/{$image}" . '" '
. 'rel="lightbox[galleryii]" '
. '>'
. '<img src="'."{$galleryii->rootFolder}{$galleryii->baseFolder}{$galleryii->thumbnails}/{$image}".'" style="width: 100%;">'
. '</a>';
echo "</div>";
echo "</div>";
}
}