support imagemagick thumb parameters, slightly reworked

references pull request #205
This commit is contained in:
Garvin Hicking 2014-09-09 13:58:09 +02:00
parent b606b91272
commit da82fd3a16
3 changed files with 14 additions and 1 deletions

View File

@ -10,6 +10,9 @@ Version 2.0-beta4 / RC? ()
* Proper SQLite PDO filenames in shared installations (Issue #214)
* ImageMagick now can get parameters to generate thumbnails,
see serendipity_config.inc.php for example values
Version 2.0-beta3 (July 25th, 2014)
------------------------------------------------------------------------

View File

@ -671,7 +671,7 @@ function serendipity_makeThumbnail($file, $directory = '', $size = false, $thumb
if (!$force_resize && serendipity_ini_bool(ini_get('safe_mode')) === false) {
$newSize .= '>'; // Tell imagemagick to not enlarge small images, only works if safe_mode is off (safe_mode turns > in to \>)
}
$cmd = escapeshellcmd($serendipity['convert']) . ' -antialias -resize '. serendipity_escapeshellarg($newSize) .'\! '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);
$cmd = escapeshellcmd($serendipity['convert'] . ' ' . $serendipity['imagemagick_thumb_parameters']) . ' -antialias -resize ' . serendipity_escapeshellarg($newSize) . '\! ' . serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);
}
exec($cmd, $output, $result);
if ($result != 0) {

View File

@ -446,5 +446,15 @@ if (isset($_SESSION['serendipityEmail'])) {
$serendipity['email'] = $_SESSION['serendipityEmail'];
}
// You can set parameters which ImageMagick should use to generate the thumbnails
// by default, thumbs will get a little more brightness and saturation (modulate)
// an unsharp-mask (unsharp)
// and quality-compression of 75% (default would be to use quality of original image)
if (!isset($serendipity['imagemagick_thumb_parameters'])) {
$serendipity['imagemagick_thumb_parameters'] = '';
// Set a variable like below in your serendpity_config_local.inc.php
//$serendipity['imagemagick_thumb_parameters'] = '-modulate 105,140 -unsharp 0.5x0.5+1.0 -quality 75';
}
serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
/* vim: set sts=4 ts=4 expandtab : */