Browse Source

Removed redundant code in image processing.

Both paths of the code here did the same thing.
pull/40/head
Macil Tech 12 years ago
parent
commit
67ab3760ba
  1. 34
      post.php

34
post.php

@ -407,34 +407,12 @@ if (isset($_POST['delete'])) {
require_once 'inc/image.php'; require_once 'inc/image.php';
if ($config['thumb_method'] == 'imagick') { // find dimensions of an image using GD
// This is tricky, because Imagick won't let us find if (!$size = @getimagesize($upload)) {
// an image's dimensions without loading it all into error($config['error']['invalidimg']);
// memory first, unlike GD which provides the }
// getimagesize() to do exactly that. This section if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
// is why GD is required, even when using Imagick error($config['error']['maxsize']);
// 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
if (!$size = @getimagesize($upload)) {
error($config['error']['invalidimg']);
}
if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {
error($config['error']['maxsize']);
}
} }
// create image object // create image object

Loading…
Cancel
Save