1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 18:47:20 +01:00

Removed redundant code in image processing.

Both paths of the code here did the same thing.
This commit is contained in:
Macil Tech 2012-07-19 00:16:50 -06:00
parent e45efbfe87
commit 14469f80a9

View File

@ -407,27 +407,6 @@ if (isset($_POST['delete'])) {
require_once 'inc/image.php'; require_once 'inc/image.php';
if ($config['thumb_method'] == 'imagick') {
// This is tricky, because Imagick won't let us find
// an image's dimensions without loading it all into
// memory first, unlike GD which provides the
// getimagesize() to do exactly that. This section
// is why GD is required, even when using Imagick
// instead. There doesn't seem to be an alternative.
// Necessary for security, as Imagick even ignores
// PHP's memory limit.
// first try GD's getimagesize()
if ($size = @getimagesize($upload)) {
if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
error($config['error']['maxsize']);
}
} else {
// GD failed
// TODO?
}
} else {
// find dimensions of an image using GD // find dimensions of an image using GD
if (!$size = @getimagesize($upload)) { if (!$size = @getimagesize($upload)) {
error($config['error']['invalidimg']); error($config['error']['invalidimg']);
@ -435,7 +414,6 @@ if (isset($_POST['delete'])) {
if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) { if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
error($config['error']['maxsize']); error($config['error']['maxsize']);
} }
}
// create image object // create image object
$image = new Image($upload, $post['extension']); $image = new Image($upload, $post['extension']);