Remade config[redraw_image]

This commit is contained in:
Michael Save 2012-03-10 20:53:41 +11:00
parent 306a7f0e36
commit de17bdb317
2 changed files with 12 additions and 3 deletions

View File

@ -69,6 +69,10 @@
return $thumb; return $thumb;
} }
public function to($dst) {
$this->image->to($dst);
}
public function delete() { public function delete() {
file_unlink($this->src); file_unlink($this->src);
} }

View File

@ -454,6 +454,9 @@
// Move the uploaded file // Move the uploaded file
if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']); if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']);
$post['filehash'] = $config['file_hash']($post['file']);
$post['filesize'] = filesize($post['file']);
if($is_an_image) { if($is_an_image) {
// Check IE MIME type detection XSS exploit // Check IE MIME type detection XSS exploit
$buffer = file_get_contents($post['file'], null, null, null, 255); $buffer = file_get_contents($post['file'], null, null, null, 255);
@ -532,6 +535,11 @@
$thumb->_destroy(); $thumb->_destroy();
} }
if($config['redraw_image']) {
$image->to($post['file']);
}
$image->destroy(); $image->destroy();
} else { } else {
// not an image // not an image
@ -543,9 +551,6 @@
$post['thumbwidth'] = $size[0]; $post['thumbwidth'] = $size[0];
$post['thumbheight'] = $size[1]; $post['thumbheight'] = $size[1];
} }
$post['filehash'] = $config['file_hash']($post['file']);
$post['filesize'] = filesize($post['file']);
} }
if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) { if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) {