intermediate image sizes now generated

This commit is contained in:
John Bintz 2009-11-12 07:59:59 -05:00
parent 2de2df60ff
commit 12e5863738
2 changed files with 26 additions and 14 deletions

View File

@ -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 "<center>[ <strong>Activated ComicPress helpers:</strong> " . implode(", ", array_keys($this->comicpress_options['helpers'])) . " ]</center>";
}

View File

@ -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')));
}
}
?>