aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--i.php9
-rw-r--r--include/derivative.inc.php2
-rw-r--r--include/derivative_params.inc.php11
3 files changed, 17 insertions, 5 deletions
diff --git a/i.php b/i.php
index f7201cd13..d6d58f2ed 100644
--- a/i.php
+++ b/i.php
@@ -104,6 +104,7 @@ function ierror($msg, $code)
header('Request-URI: '.$url);
header('Content-Location: '.$url);
header('Location: '.$url);
+ ilog('WARN', $code, $url, $_SERVER['REQUEST_URI']);
exit;
}
if ($code>=400)
@@ -203,7 +204,7 @@ function parse_request()
{
preg_match($conf['sync_chars_regex'], $token) or ierror('Invalid chars in request', 400);
}
-
+
$page['derivative_path'] = PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.$req;
$pos = strrpos($req, '.');
@@ -452,7 +453,7 @@ SELECT *
FROM '.$prefixeTable.'images
WHERE path=\''.$page['src_location'].'\'
;';
-
+
if ( ($row=pwg_db_fetch_assoc(pwg_query($query))) )
{
if (isset($row['width']))
@@ -464,7 +465,7 @@ SELECT *
if (!isset($row['rotation']))
{
$page['rotation_angle'] = pwg_image::get_rotation_angle($page['src_path']);
-
+
single_update(
$prefixeTable.'images',
array('rotation' => pwg_image::get_rotation_code_from_angle($page['rotation_angle'])),
@@ -540,7 +541,7 @@ if ($params->sharpen)
$timing['sharpen'] = time_step($step);
}
-if ($params->use_watermark)
+if ($params->will_watermark($d_size))
{
$wm = ImageStdParams::get_watermark();
$wm_image = new pwg_image(PHPWG_ROOT_PATH.$wm->file);
diff --git a/include/derivative.inc.php b/include/derivative.inc.php
index d19b5a1b8..b89e39e3b 100644
--- a/include/derivative.inc.php
+++ b/include/derivative.inc.php
@@ -197,7 +197,7 @@ final class DerivativeImage
{
if ( $src->has_size() && $params->is_identity( $src->get_size() ) )
{
- if (!$params->use_watermark && !$src->rotation)
+ if (!$params->will_watermark($src->get_size()) && !$src->rotation)
{
$params = null;
$rel_path = $rel_url = $src->rel_path;
diff --git a/include/derivative_params.inc.php b/include/derivative_params.inc.php
index 3128e5fb2..b29255c53 100644
--- a/include/derivative_params.inc.php
+++ b/include/derivative_params.inc.php
@@ -281,5 +281,16 @@ final class DerivativeParams
}
return true;
}
+
+ function will_watermark($out_size)
+ {
+ if ($this->use_watermark)
+ {
+ $min_size = ImageStdParams::get_watermark()->min_size;
+ return $min_size[0]<=$out_size[0]
+ && $min_size[1]<=$$out_size[1];
+ }
+ return false;
+ }
}
?> \ No newline at end of file