editor max image size
This commit is contained in:
parent
d27c3040bf
commit
9b3b25f7fa
@ -95,9 +95,11 @@ class ComicPress {
|
||||
}
|
||||
|
||||
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));
|
||||
if (isset($this->comicpress_options['image_types'][$size])) {
|
||||
if (isset($this->comicpress_options['image_types'][$size]['dimensions'])) {
|
||||
list($width, $height) = explode('x', $this->comicpress_options['image_types'][$size]['dimensions']);
|
||||
$current_max = array(intval($width), intval($height));
|
||||
}
|
||||
}
|
||||
return $current_max;
|
||||
}
|
||||
@ -207,4 +209,4 @@ class ComicPress {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -210,6 +210,28 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
$this->assertEquals(array('test3', 'comic', 'test', 'test2'), $this->cp->intermediate_image_sizes(array('test3')));
|
||||
}
|
||||
|
||||
function providerTestEditorMaxImageSize() {
|
||||
return array(
|
||||
array(array(1, 1), 'comic', array(760, 500)),
|
||||
array(array(1, 1), 'test', array(1, 1)),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestEditorMaxImageSize
|
||||
*/
|
||||
function testEditorMaxImageSize($input, $type, $expected_result) {
|
||||
$this->cp->comicpress_options = array(
|
||||
'image_types' => array(
|
||||
'comic' => array(
|
||||
'dimensions' => '760x500'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals($expected_result, $this->cp->editor_max_image_size($input, $type));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user