From bb1abb85e1dd089497b6a852c5b95e89c211b6d8 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 3 Nov 2010 23:37:28 +1100 Subject: Ability to strip excess data (commonly ZIP archives) from images. --- post.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'post.php') diff --git a/post.php b/post.php index 9ba09fc1..a974987a 100644 --- a/post.php +++ b/post.php @@ -130,8 +130,32 @@ $post['filehash'] = md5_file($post['file']); $post['filesize'] = filesize($post['file']); + $image = createimage($post['extension'], $post['file']); + + if(REDRAW_IMAGE) { + switch($post['extension']) { + case 'jpg': + case 'jpeg': + imagejpeg($image, $post['file'], JPEG_QUALITY); + break; + case 'png': + imagepng($image, $post['file'], 7); + break; + case 'gif': + imagegif($image, $post['file']); + break; + case 'bmp': + imagebmp($image, $post['file']); + break; + default: + error('Unknwon file extension.'); + } + } + // Create a thumbnail - $thumb = resize($post['extension'], $post['file'], $post['thumb'], THUMB_WIDTH, THUMB_HEIGHT); + $thumb = resize($image, $post['width'], $post['height'], $post['thumb'], THUMB_WIDTH, THUMB_HEIGHT); + + $post['thumbwidth'] = $thumb['width']; $post['thumbheight'] = $thumb['height']; } -- cgit v1.3