From 1c198b4f6a1df111061a420ecd8d4c8f3c022def Mon Sep 17 00:00:00 2001 From: colings Date: Sun, 2 Jan 2011 23:47:30 +0800 Subject: [PATCH] Maybe working? --- .../helpers/custom_albums_graphics.php | 30 +++++++++++-------- .../helpers/custom_albums_installer.php | 4 --- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/3.0/modules/custom_albums/helpers/custom_albums_graphics.php b/3.0/modules/custom_albums/helpers/custom_albums_graphics.php index 5fa6cd49..b6d6702a 100644 --- a/3.0/modules/custom_albums/helpers/custom_albums_graphics.php +++ b/3.0/modules/custom_albums/helpers/custom_albums_graphics.php @@ -37,21 +37,25 @@ class custom_albums_graphics_Core { $albumCustom = ORM::factory("custom_album")->where("album_id", "=", $options["parent_id"])->find(); -/* - $dims = getimagesize($input_file); - if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) { - // Image would get upscaled; do nothing - copy($input_file, $output_file); - } else { - $image = Image::factory($input_file) - ->resize($options["width"], $options["height"], $options["master"]) - ->quality(module::get_var("gallery", "image_quality")); - if (graphics::can("sharpen")) { - $image->sharpen(module::get_var("gallery", "image_sharpen")); + // If this album has custom data, build the thumbnail at the specified size + if ($albumCustom->loaded()) { + $thumb_size = $albumCustom->thumb_size; + + $dims = getimagesize($input_file); + if (max($dims[0], $dims[1]) < $thumb_size) { + // Image would get upscaled; do nothing + copy($input_file, $output_file); + } else { + $image = Image::factory($input_file) + ->resize($thumb_size, $thumb_size, $options["master"]) + ->quality(module::get_var("gallery", "image_quality")); + if (graphics::can("sharpen")) { + $image->sharpen(module::get_var("gallery", "image_sharpen")); + } + $image->save($output_file); } - $image->save($output_file); } -*/ + module::event("graphics_resize_completed", $input_file, $output_file, $options); } } diff --git a/3.0/modules/custom_albums/helpers/custom_albums_installer.php b/3.0/modules/custom_albums/helpers/custom_albums_installer.php index 477b70e0..319912e9 100644 --- a/3.0/modules/custom_albums/helpers/custom_albums_installer.php +++ b/3.0/modules/custom_albums/helpers/custom_albums_installer.php @@ -24,10 +24,6 @@ class custom_albums_installer { "gallery", "thumb", "custom_albums::resize", array("width" => 0, "height" => 0, "master" => Image::AUTO), 200); - graphics::add_rule( - "gallery", "resize", "custom_albums::resize", - array("width" => 0, "height" => 0, "master" => Image::AUTO), - 200); // Create a table to store custom album info in. $db = Database::instance();