summaryrefslogtreecommitdiff
path: root/utils/imagecache.php
diff options
context:
space:
mode:
authordeva <deva>2010-02-23 09:21:02 +0000
committerdeva <deva>2010-02-23 09:21:02 +0000
commitd908520b7ebde8e209a5db89a505f959ad6b76c4 (patch)
treee80c930bf7d7728af9bcfd2799c9fee008252ab5 /utils/imagecache.php
parent422a3ff80c49f50eb7841e3f30f4bd96b9d2d2ce (diff)
New imagecache generation system.
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);