mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-13 19:56:23 +00:00
added new config option and fixed fencepost error when counting resized images
This commit is contained in:
@@ -96,8 +96,11 @@ class Image
|
|||||||
$width = imagesx($img);
|
$width = imagesx($img);
|
||||||
$height = imagesy($img);
|
$height = imagesy($img);
|
||||||
|
|
||||||
|
if(!ALLOW_BLOATING)
|
||||||
|
{
|
||||||
if($maxwidth>$width)$maxwidth = $width;
|
if($maxwidth>$width)$maxwidth = $width;
|
||||||
if($maxheight>$height)$maxheight = $height;
|
if($maxheight>$height)$maxheight = $height;
|
||||||
|
}
|
||||||
|
|
||||||
if ($height > $width)
|
if ($height > $width)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ function renderImage($data)
|
|||||||
$path = $cachepath;
|
$path = $cachepath;
|
||||||
$cached = true;
|
$cached = true;
|
||||||
}
|
}
|
||||||
else if($pm->countResizedImages($hash)>MAX_RESIZED_IMAGES) //if the number of max resized images is reached, just show the real one
|
else if(MAX_RESIZED_IMAGES > -1 && $pm->countResizedImages($hash)>MAX_RESIZED_IMAGES) //if the number of max resized images is reached, just show the real one
|
||||||
$path = ROOT.DS.'upload'.DS.$hash.DS.$hash;
|
$path = ROOT.DS.'upload'.DS.$hash.DS.$hash;
|
||||||
|
|
||||||
switch($type)
|
switch($type)
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ session_start();
|
|||||||
// shall we log all uploaders IP addresses?
|
// shall we log all uploaders IP addresses?
|
||||||
define('LOG_UPLOADER', true);
|
define('LOG_UPLOADER', true);
|
||||||
|
|
||||||
//how many resizes may one image have?
|
//how many resizes may one image have? set it to -1 for infinite resizes
|
||||||
define('MAX_RESIZED_IMAGES',50);
|
define('MAX_RESIZED_IMAGES',4);
|
||||||
|
|
||||||
|
//when the user requests a resize. Can the resized image be bigger than the original?
|
||||||
|
define('ALLOW_BLOATING', false);
|
||||||
|
|
||||||
|
|
||||||
//don't change stuff beyond this point
|
//don't change stuff beyond this point
|
||||||
define('DOMAINPATH',(isset($_SERVER['HTTPS'])?'https':'http').'://'.$_SERVER['HTTP_HOST'].'/');
|
define('DOMAINPATH',(isset($_SERVER['HTTPS'])?'https':'http').'://'.$_SERVER['HTTP_HOST'].'/');
|
||||||
|
|||||||
Reference in New Issue
Block a user