When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use that as a thumbnail instead. (optional)
This commit is contained in:
parent
e7eae32892
commit
5f94009fad
@ -153,6 +153,9 @@
|
|||||||
$config['thumb_width'] = 255;
|
$config['thumb_width'] = 255;
|
||||||
$config['thumb_height'] = 255;
|
$config['thumb_height'] = 255;
|
||||||
|
|
||||||
|
// When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use that as a thumbnail instead of resizing/redrawing
|
||||||
|
$config['minimum_copy_resize'] = true;
|
||||||
|
|
||||||
// Store image hash in the database for r9k-like boards implementation soon
|
// Store image hash in the database for r9k-like boards implementation soon
|
||||||
// Function name for hashing
|
// Function name for hashing
|
||||||
// sha1_file, md5_file, etc.
|
// sha1_file, md5_file, etc.
|
||||||
|
10
post.php
10
post.php
@ -414,6 +414,15 @@
|
|||||||
$post['filehash'] = $config['file_hash']($post['file']);
|
$post['filehash'] = $config['file_hash']($post['file']);
|
||||||
$post['filesize'] = filesize($post['file']);
|
$post['filesize'] = filesize($post['file']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($config['minimum_copy_resize'] && $post['width'] < $config['thumb_width'] && $post['height'] < $config['thumb_height']) {
|
||||||
|
// Copy, because there's nothing to resize
|
||||||
|
copy($post['file'], $post['thumb']);
|
||||||
|
|
||||||
|
$post['thumbwidth'] = $post['width'];
|
||||||
|
$post['thumbheight'] = $post['height'];
|
||||||
|
} else {
|
||||||
$image = createimage($post['extension'], $post['file']);
|
$image = createimage($post['extension'], $post['file']);
|
||||||
|
|
||||||
// Create a thumbnail
|
// Create a thumbnail
|
||||||
@ -422,6 +431,7 @@
|
|||||||
$post['thumbwidth'] = $thumb['width'];
|
$post['thumbwidth'] = $thumb['width'];
|
||||||
$post['thumbheight'] = $thumb['height'];
|
$post['thumbheight'] = $thumb['height'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) {
|
if($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) {
|
||||||
undoImage($post);
|
undoImage($post);
|
||||||
|
Loading…
Reference in New Issue
Block a user