summaryrefslogtreecommitdiff
path: root/utils/modules
diff options
context:
space:
mode:
Diffstat (limited to 'utils/modules')
-rw-r--r--utils/modules/discography.php17
-rw-r--r--utils/modules/gallery.php51
2 files changed, 48 insertions, 20 deletions
diff --git a/utils/modules/discography.php b/utils/modules/discography.php
index a8bfb5e..bc37022 100644
--- a/utils/modules/discography.php
+++ b/utils/modules/discography.php
@@ -139,7 +139,7 @@ class Disc {
$str .= " <div class=\"cover\">\n";
$str .= " <a href=\"".$this->cover."\">\n";
$str .= " <img alt=\"".$this->title." cover\"\n";
- $str .= " src=\"?mode=imagecache&amp;uri=" . $this->cover . "&amp;mw=200&amp;mh=200\"/>\n";
+ $str .= " src=\"?mode=imagecache&amp;uri=" . $this->cover . "&amp;mod=discography&amp;cat=cover\"/>\n";
$str .= " </a>\n";
$str .= " </div>\n";
$str .= " <span class=\"label\">";
@@ -247,6 +247,15 @@ class Discography {
$key = $disc->releasetime;
$this->discs[$key] = $disc;
}
+
+ public function getImageSize($cat)
+ {
+ switch($cat) {
+ default:
+ case "cover":
+ return new ImageSize($this->coverwidth, $this->coverheight);
+ }
+ }
public function write()
{
@@ -267,6 +276,12 @@ class Discography {
$dom = new DomDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->load($this->file);
+
+ $discography = $dom->documentElement;
+
+ $this->coverwidth = $discography->getAttribute('coverwidth');
+ $this->coverheight = $discography->getAttribute('coverheight');
+
$discs = $dom->getElementsByTagName('disc');
foreach($discs as $d) {
diff --git a/utils/modules/gallery.php b/utils/modules/gallery.php
index e9b2934..d2b751c 100644
--- a/utils/modules/gallery.php
+++ b/utils/modules/gallery.php
@@ -42,18 +42,18 @@ class Photo {
htmlspecialchars($this->image, ENT_QUOTES, "UTF-8") . "\"/>\n");
}
- public function show($indent, $maxwidth = 100, $maxheight = 100, $showbig = false)
+ public function show($indent, $cat)
{
$str = "";
$str .= $indent."<span class=\"photo\">\n";
- if($showbig) $str .= $indent." <a href=\"" . $this->path . "/" . $this->image . "\">\n";
+ if($cat == "photo") $str .= $indent." <a href=\"" . $this->path . "/" . $this->image . "\">\n";
$str .= $indent." <span class=\"photo_image\">\n";
$str .= $indent." <img alt=\"".$this->title."\"\n";
$str .= $indent." src=\"?mode=imagecache&amp;uri="
- . $this->path . "/" . $this->image . "&amp;mw=".$maxwidth."&amp;mh=".$maxheight."\"/>\n";
+ . $this->path . "/" . $this->image . "&amp;mod=gallery&amp;cat=".$cat."\"/>\n";
$str .= $indent." </span>\n";
- if($showbig) $str .= $indent." </a>\n";
+ if($cat == "photo") $str .= $indent." </a>\n";
$str .= $indent." <span class=\"photo_caption\">" . $this->title . "</span>\n";
$str .= $indent."</span>\n";
return $str;
@@ -100,7 +100,7 @@ class Album {
fwrite($fp, " </album>\n");
}
- public function show($indent, $maxwidth, $maxheight)
+ public function show($indent)
{
global $page;
@@ -109,7 +109,7 @@ class Album {
$str .= $indent." <span class=\"album_title\">" . $this->title . "</span>\n";
foreach($this->photos as $photo) {
$str .= $indent." <a class=\"photo_icon\" href=\"?page=".$page."&amp;a=".$this->id."&amp;p=".$photo->id."\">\n";
- $str .= $photo->show($indent." ", $maxwidth, $maxheight);
+ $str .= $photo->show($indent." ", "albumicon");
$str .= $indent." </a>\n";
}
$str .= $indent."</span>\n";
@@ -117,7 +117,7 @@ class Album {
return $str;
}
- public function showIcon($indent, $maxwidth, $maxheight)
+ public function showIcon($indent)
{
global $page;
@@ -126,14 +126,14 @@ class Album {
$str .= $indent."<a class=\"album\" href=\"?page=".$page."&amp;a=".$this->id."\">\n";
$str .= $indent." <span class=\"album_title\">".$this->title."</span>\n";
$str .= $indent." <span class=\"album_icon\">\n";
- $str .= $this->photos[$this->icon]->show($indent." ", $maxwidth, $maxheight);
+ $str .= $this->photos[$this->icon]->show($indent." ", "albumicon");
$str .= $indent." </span>\n";
$str .= $indent."</a>\n";
return $str;
}
- public function showPhoto($indent, $photo, $maxwidth, $maxheight, $maxwidth_icon, $maxheight_icon)
+ public function showPhoto($indent, $photo)
{
global $GLOBALS;
@@ -141,12 +141,12 @@ class Album {
$str = "";
- $str = $this->photos[$photo]->show($indent, $maxwidth, $maxheight, true);
+ $str = $this->photos[$photo]->show($indent, "photo");
$str .= $indent."<span class=\"nav_icons\">\n";
if($this->photos[$photo - 1]) {
$str .= $indent." <a class=\"nav_icon\" href=\"?page=gallery&amp;a=".$album."&amp;p=".($photo-1)."\">\n";
- $str .= $this->photos[$photo - 1]->show($indent." ", $maxwidth_icon, $maxheight_icon);
+ $str .= $this->photos[$photo - 1]->show($indent." ", "navicon");
$str .= $indent." </a>\n";
} else {
$str .= $indent." <a class=\"nav_icon\" href=\"?page=gallery&amp;a=".$album."\">\n";
@@ -160,7 +160,7 @@ class Album {
if($this->photos[$photo + 1]) {
$str .= $indent." <a class=\"nav_icon\" href=\"?page=gallery&amp;a=".$album."&amp;p=".($photo+1)."\">\n";
- $str .= $this->photos[$photo + 1]->show($indent." ", $maxwidth_icon, $maxheight_icon);
+ $str .= $this->photos[$photo + 1]->show($indent." ", "navicon");
$str .= $indent." </a>\n";
} else {
$str .= $indent." <a class=\"nav_icon\" href=\"?page=gallery&amp;a=".$album."\">\n";
@@ -269,7 +269,7 @@ class Gallery {
unpackImages($_FILES['images'], $album);
$this->add($album);
$this->write();
- echo $album->show("", $this->maxwidth_icon, $this->maxheight_icon);
+ echo $album->show("", "albumicon");
break;
case "select":
@@ -339,7 +339,7 @@ class Gallery {
$photo = array_rand($this->albums[$album]->photos);
$str .= " <a class=\"random_photo_link\" href=\"?page=gallery&amp;a=".$album."&amp;p=".$photo."\">\n";
- $str .= $this->albums[$album]->photos[$photo]->show(" ", $this->maxwidth_rand, $this->maxheight_rand);
+ $str .= $this->albums[$album]->photos[$photo]->show(" ", "randomimage");
$str .= " </a>\n";
return $str;
@@ -351,7 +351,7 @@ class Gallery {
$str .= "\n<span class=\"albums\">\n";
foreach($this->albums as $album) {
- $str .= $album->showIcon(" ", $this->maxwidth_icon, $this->maxheight_icon);
+ $str .= $album->showIcon(" ");
}
$str .= "</span>\n";
@@ -363,9 +363,7 @@ class Gallery {
$str = "";
if($this->albums[$album]) {
- $str .= $this->albums[$album]->showPhoto(" ", $photo,
- $this->maxwidth, $this->maxheight,
- $this->maxwidth_icon, $this->maxheight_icon);
+ $str .= $this->albums[$album]->showPhoto(" ", $photo);
}
return $str;
@@ -387,7 +385,7 @@ class Gallery {
default:
if($p != "" && $a != "") $str .= $this->showPhoto($a, $p);
else if($a != "" && $this->albums[$a] && $p == "")
- $str .= $this->albums[$a]->show(" ", $this->maxwidth_icon, $this->maxheight_icon);
+ $str .= $this->albums[$a]->show(" ");
else $str .= $this->showAlbums();
break;
}
@@ -410,6 +408,21 @@ class Gallery {
return $maxid + 1;
}
+ public function getImageSize($cat)
+ {
+ switch($cat) {
+ case "photo":
+ return new ImageSize($this->maxwidth, $this->maxheight);
+ case "randomimage":
+ return new ImageSize($this->maxwidth_rand, $this->maxheight_rand);
+ case "navicon":
+ return new ImageSize($this->maxwidth_icon * 0.7, $this->maxheight_icon * 0.7);
+ default:
+ case "albumicon":
+ return new ImageSize($this->maxwidth_icon, $this->maxheight_icon);
+ }
+ }
+
public function write()
{
$fp = fopen($this->file, "w");