summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/functions.php7
-rw-r--r--post.php5
2 files changed, 10 insertions, 2 deletions
diff --git a/inc/functions.php b/inc/functions.php
index d0929eef..535defb5 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1122,7 +1122,14 @@
return $res;
}
+ function undoImage($post) {
+ unlink($post['file']);
+ unlink($post['thumb']);
+ }
+
function createimage($type, $source_pic) {
+ global $config;
+
$image = false;
switch($type) {
case 'jpg':
diff --git a/post.php b/post.php
index 71a2faae..f15545bb 100644
--- a/post.php
+++ b/post.php
@@ -247,12 +247,12 @@
// Check if the image is valid
if($post['width'] < 1 || $post['height'] < 1) {
- unlink($post['file']);
+ undoImage($post);
error($config['error']['invalidimg']);
}
if($post['width'] > $config['max_width'] || $post['height'] > $config['max_height']) {
- unlink($post['file']);
+ undoImage($post);
error($config['error']['maxsize']);
}
@@ -269,6 +269,7 @@
}
if(!($mod && $mod['type'] >= $config['mod']['postunoriginal']) && $config['robot_enable'] && checkRobot($post['body_nomarkup'])) {
+ undoImage($post);
if($config['robot_mute']) {
error(sprintf($config['error']['muted'], mute()));
} else {