From 12e58637385b4cb2dfff53962c95371a7af1c3f1 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 12 Nov 2009 07:59:59 -0500 Subject: [PATCH] intermediate image sizes now generated --- classes/ComicPress.inc | 28 ++++++++++++++-------------- test/ComicPressTest.php | 12 ++++++++++++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 345c343..3d5042f 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -88,6 +88,20 @@ class ComicPress { } } + // WordPress Filters + + function intermediate_image_sizes($sizes) { + return array_merge($sizes, array_keys($this->comicpress_options['image_types'])); + } + + function editor_max_image_size($current_max, $size) { + if (isset($this->comicpress_options["${size}_dimensions"])) { + list($width, $height) = explode('x', $this->comicpress_options["${size}_dimensions"]); + $current_max = array(intval($width), intval($height)); + } + return $current_max; + } + // @codeCoverageIgnoreStart /** @@ -119,20 +133,6 @@ class ComicPress { } } - // WordPress Filters - - function intermediate_image_sizes($sizes) { - return array_merge($sizes, array('comic', 'rss', 'archive', 'mini')); - } - - function editor_max_image_size($current_max, $size) { - if (isset($this->comicpress_options["${size}_dimensions"])) { - list($width, $height) = explode('x', $this->comicpress_options["${size}_dimensions"]); - $current_max = array(intval($width), intval($height)); - } - return $current_max; - } - function announce_activated_helpers() { echo "
[ Activated ComicPress helpers: " . implode(", ", array_keys($this->comicpress_options['helpers'])) . " ]
"; } diff --git a/test/ComicPressTest.php b/test/ComicPressTest.php index d0831fd..808b6f0 100644 --- a/test/ComicPressTest.php +++ b/test/ComicPressTest.php @@ -198,6 +198,18 @@ class ComicPressTest extends PHPUnit_Framework_TestCase { function testArrayMergeReplaceRecursive($inputs, $expected_output) { $this->assertEquals($expected_output, call_user_func_array(array($this->cp, '_array_merge_replace_recursive'), $inputs)); } + + function testIntermediateImageSizes() { + $this->cp->comicpress_options = array( + 'image_types' => array( + 'comic' => true, + 'test' => true, + 'test2' => true, + ) + ); + + $this->assertEquals(array('test3', 'comic', 'test', 'test2'), $this->cp->intermediate_image_sizes(array('test3'))); + } } ?> \ No newline at end of file