summaryrefslogtreecommitdiff
path: root/utils/imagecache.php
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imagecache.php')
-rw-r--r--utils/imagecache.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/utils/imagecache.php b/utils/imagecache.php
index 8aaaba9..811ba0c 100644
--- a/utils/imagecache.php
+++ b/utils/imagecache.php
@@ -1,6 +1,18 @@
<?php
include_once("config.php");
+include_once($UTIL_DIR . "/modules.php");
+
+class ImageSize {
+ public $width;
+ public $height;
+
+ public function ImageSize($w, $h)
+ {
+ $this->width = $w;
+ $this->height = $h;
+ }
+};
function rescale($image, $maxwidth, $maxheight)
{
@@ -31,8 +43,26 @@ function errorImage($message)
imagedestroy($im);
}
-function getCachedImage($filename, $maxwidth, $maxheight)
+function getCachedImage($filename, $mod, $cat)
{
+ global $modules;
+ loadModule($mod);
+ if(!$modules[$mod]) die(404);
+
+ $size = $modules[$mod]->getImageSize($cat);
+ $maxwidth = $size->width;
+ $maxheight = $size->height;
+
+ /*
+ if($mod == "discography") {
+ if($cat == "cover") { $maxwidth = 100; $maxheight = 100; }
+ }
+ if($mod == "gallery") {
+ if($cat == "randomimage") { $maxwidth = 100; $maxheight = 100; }
+ if($cat == "photo") { $maxwidth = 100; $maxheight = 100; }
+ if($cat == "albumicon") { $maxwidth = 100; $maxheight = 100; }
+ }
+ */
global $IMAGECACHE, $JPEG_CACHE_QUALITY;
$fullfilename = $IMAGECACHE . "/" . $maxwidth . ":" . $maxheight . ":". urlencode($filename);