mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 16:24:33 +00:00
Respect profile activation and minimum sizes at runtime
This commit is contained in:
@@ -78,7 +78,7 @@ function bratonien_tools_filter_derivative_url($url, $params, $src_image, $rel_u
|
||||
}
|
||||
|
||||
$profile = bratonien_tools_get_watermark_profile((int)$rule['profile_id']);
|
||||
if (!$profile || empty($profile['watermark_file']))
|
||||
if (!$profile || empty($profile['active']) || empty($profile['watermark_file']))
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
@@ -89,6 +89,15 @@ function bratonien_tools_filter_derivative_url($url, $params, $src_image, $rel_u
|
||||
return $url;
|
||||
}
|
||||
|
||||
if (is_object($params) && is_object($src_image) && $src_image->has_size())
|
||||
{
|
||||
$size = $params->compute_final_size($src_image->get_size());
|
||||
if ($size && ($size[0] < (int)$profile['min_width'] || $size[1] < (int)$profile['min_height']))
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
$profile_id = (int)$profile['id'];
|
||||
$signature = bratonien_tools_runtime_sign($rel_url, $profile_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user