forked from GithubBackups/tinyib
Add TINYIB_MAXWOP and TINYIB_MAXHOP which specify thumbnail sizes only for new threads
This commit is contained in:
parent
06b370d816
commit
58d378fe46
@ -126,7 +126,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
|
|||||||
|
|
||||||
$post['image_width'] = $file_info[0]; $post['image_height'] = $file_info[1];
|
$post['image_width'] = $file_info[0]; $post['image_height'] = $file_info[1];
|
||||||
|
|
||||||
list($thumb_maxwidth, $thumb_maxheight) = thumbnailDimensions($post['image_width'], $post['image_height']);
|
list($thumb_maxwidth, $thumb_maxheight) = thumbnailDimensions($post);
|
||||||
|
|
||||||
if (!createThumbnail($file_location, $thumb_location, $thumb_maxwidth, $thumb_maxheight)) {
|
if (!createThumbnail($file_location, $thumb_location, $thumb_maxwidth, $thumb_maxheight)) {
|
||||||
fancyDie("Could not create thumbnail.");
|
fancyDie("Could not create thumbnail.");
|
||||||
|
@ -8,4 +8,6 @@ define('TINYIB_RESPAGE', true);
|
|||||||
// The following are provided for backward compatibility and should not be relied upon
|
// The following are provided for backward compatibility and should not be relied upon
|
||||||
// Copy new settings from settings.default.php to settings.php
|
// Copy new settings from settings.default.php to settings.php
|
||||||
if (!defined('TINYIB_MAXREPLIES')) { define('TINYIB_MAXREPLIES', 0); }
|
if (!defined('TINYIB_MAXREPLIES')) { define('TINYIB_MAXREPLIES', 0); }
|
||||||
|
if (!defined('TINYIB_MAXWOP')) { define('TINYIB_MAXWOP', TINYIB_MAXW); }
|
||||||
|
if (!defined('TINYIB_MAXHOP')) { define('TINYIB_MAXHOP', TINYIB_MAXH); }
|
||||||
?>
|
?>
|
@ -282,8 +282,15 @@ function checkDuplicateImage($hex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function thumbnailDimensions($width, $height) {
|
function thumbnailDimensions($post) {
|
||||||
return ($width > TINYIB_MAXW || $height > TINYIB_MAXH) ? array(TINYIB_MAXW, TINYIB_MAXH) : array($width, $height);
|
if ($post['parent'] == TINYIB_NEWTHREAD) {
|
||||||
|
$max_width = TINYIB_MAXWOP;
|
||||||
|
$max_height = TINYIB_MAXHOP;
|
||||||
|
} else {
|
||||||
|
$max_width = TINYIB_MAXW;
|
||||||
|
$max_height = TINYIB_MAXH;
|
||||||
|
}
|
||||||
|
return ($post['image_width'] > $max_width || $post['image_height'] > $max_height) ? array($max_width, $max_height) : array($post['image_width'], $post['image_height']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createThumbnail($name, $filename, $new_w, $new_h) {
|
function createThumbnail($name, $filename, $new_w, $new_h) {
|
||||||
|
@ -121,7 +121,10 @@ EOF;
|
|||||||
|
|
||||||
function buildPage($htmlposts, $parent, $pages=0, $thispage=0) {
|
function buildPage($htmlposts, $parent, $pages=0, $thispage=0) {
|
||||||
$managelink = basename($_SERVER['PHP_SELF']) . "?manage";
|
$managelink = basename($_SERVER['PHP_SELF']) . "?manage";
|
||||||
$maxdimensions = TINYIB_MAXW . 'x' . TINYIB_MAXH;
|
$maxdimensions = TINYIB_MAXWOP . 'x' . TINYIB_MAXHOP;
|
||||||
|
if (TINYIB_MAXW != TINYIB_MAXWOP || TINYIB_MAXH != TINYIB_MAXHOP) {
|
||||||
|
$maxdimensions .= ' (new thread) or ' . TINYIB_MAXW . 'x' . TINYIB_MAXH . ' (reply)';
|
||||||
|
}
|
||||||
$maxfilesize = TINYIB_MAXKB * 1024;
|
$maxfilesize = TINYIB_MAXKB * 1024;
|
||||||
|
|
||||||
$postingmode = "";
|
$postingmode = "";
|
||||||
@ -239,9 +242,9 @@ EOF;
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="rules">
|
<td colspan="2" class="rules">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Supported file types are: GIF, JPG, PNG</li>
|
<li>Supported file types are GIF, JPG, and PNG.</li>
|
||||||
$max_file_size_html
|
$max_file_size_html
|
||||||
<li>Images greater than $maxdimensions pixels will be thumbnailed.</li>
|
<li>Images greater than $maxdimensions will be thumbnailed.</li>
|
||||||
$unique_posts_html
|
$unique_posts_html
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
@ -8,8 +8,10 @@ define('TINYIB_PREVIEWREPLIES', 3); // Amount of replies previewed on index page
|
|||||||
define('TINYIB_MAXREPLIES', 0); // Maximum replies before a thread stops bumping [0 to disable]
|
define('TINYIB_MAXREPLIES', 0); // Maximum replies before a thread stops bumping [0 to disable]
|
||||||
define('TINYIB_MAXKB', 2048); // Maximum file size in kilobytes [0 to disable]
|
define('TINYIB_MAXKB', 2048); // Maximum file size in kilobytes [0 to disable]
|
||||||
define('TINYIB_MAXKBDESC', "2 MB"); // Human-readable representation of the maximum file size
|
define('TINYIB_MAXKBDESC', "2 MB"); // Human-readable representation of the maximum file size
|
||||||
define('TINYIB_MAXW', 250); // Maximum image width
|
define('TINYIB_MAXW', 250); // Maximum image width (reply) - Images exceeding these sizes will be thumbnailed
|
||||||
define('TINYIB_MAXH', 250); // Maximum image height - Images exceeding these sizes will be thumbnailed
|
define('TINYIB_MAXH', 250); // Maximum image height (reply)
|
||||||
|
define('TINYIB_MAXWOP', 250); // Maximum image width (new thread)
|
||||||
|
define('TINYIB_MAXHOP', 250); // Maximum image height (new thread)
|
||||||
define('TINYIB_DELAY', 30); // Delay between posts to help control flooding [0 to disable]
|
define('TINYIB_DELAY', 30); // Delay between posts to help control flooding [0 to disable]
|
||||||
define('TINYIB_LOGO', ""); // Logo HTML
|
define('TINYIB_LOGO', ""); // Logo HTML
|
||||||
define('TINYIB_TRIPSEED', ""); // Enter some random text - Used when generating secure tripcodes - Must not change once set
|
define('TINYIB_TRIPSEED', ""); // Enter some random text - Used when generating secure tripcodes - Must not change once set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user