diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-04 02:46:39 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-04 02:46:39 +1100 |
| commit | 53dce652a863d819760fe4f878ccbb59c9c1a551 (patch) | |
| tree | b646eaa383775e6f8a48426637393a3ef8f20db6 /post.php | |
| parent | 713c955370aa53c42ef76d981f3996b8a27c21cf (diff) | |
image spoilers
Diffstat (limited to 'post.php')
| -rw-r--r-- | post.php | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -459,7 +459,6 @@ } } - // create image object $image = new Image($post['file'], $post['extension']); @@ -471,23 +470,29 @@ $post['width'] = $image->size->width; $post['height'] = $image->size->height; - if($config['minimum_copy_resize'] && + if($config['spoiler_images'] && isset($_POST['spoiler'])) { + $post['thumb'] = 'spoiler'; + + $size = @getimagesize($config['spoiler_image']); + $post['thumbwidth'] = $size[0]; + $post['thumbheight'] = $size[1]; + } elseif($config['minimum_copy_resize'] && $image->size->width <= $config['thumb_width'] && $image->size->height <= $config['thumb_height'] && $post['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension'])) { - + // Copy, because there's nothing to resize copy($post['file'], $post['thumb']); - + $post['thumbwidth'] = $image->size->width; $post['thumbheight'] = $image->size->height; } else { $thumb = $image->resize($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension'], $config['thumb_width'], $config['thumb_height']); $thumb->to($post['thumb']); - + $post['thumbwidth'] = $thumb->width; $post['thumbheight'] = $thumb->height; - + $thumb->_destroy(); } $image->destroy(); @@ -531,7 +536,7 @@ // Remove DIR_* before inserting them into the database. if($post['has_file']) { $post['file'] = substr_replace($post['file'], '', 0, strlen($board['dir'] . $config['dir']['img'])); - if($is_an_image) + if($is_an_image && $post['thumb'] != 'spoiler') $post['thumb'] = substr_replace($post['thumb'], '', 0, strlen($board['dir'] . $config['dir']['thumb'])); } |
