[geeklog-cvs] geeklog: Added a configuration option to control the JPEG qualit...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Nov 16 04:30:18 EST 2008


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1ffedc7146eb
changeset: 6470:1ffedc7146eb
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Nov 16 10:30:00 2008 +0100
description:
Added a configuration option to control the JPEG quality (Feature request #0000720)

diffstat:

12 files changed, 79 insertions(+), 19 deletions(-)
language/english.php                         |    1 
language/english_utf-8.php                   |    1 
language/german.php                          |    1 
language/german_formal.php                   |    1 
language/german_formal_utf-8.php             |    1 
language/german_utf-8.php                    |    1 
public_html/admin/install/config-install.php |    1 
public_html/admin/install/index.php          |    4 ++
public_html/docs/config.html                 |   50 ++++++++++++++++----------
public_html/docs/history                     |    3 +
sql/updates/mssql_1.5.1_to_1.5.2.php         |   17 ++++++++
sql/updates/mysql_1.5.1_to_1.5.2.php         |   17 ++++++++

diffs (274 lines):

diff -r fac2f37acc57 -r 1ffedc7146eb language/english.php
--- a/language/english.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/english.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1757,6 +1757,7 @@
     'debug_image_upload' => "Debug Image Uploading?",
     'keep_unscaled_image' => "Keep Unscaled Image?",
     'allow_user_scaling' => "Allow User Scaling?",
+    'jpeg_quality' => 'JPEG Quality?',
     'max_image_width' => "Max Image Width?",
     'max_image_height' => "Max Image Height?",
     'max_image_size' => "Max Image Size?",
diff -r fac2f37acc57 -r 1ffedc7146eb language/english_utf-8.php
--- a/language/english_utf-8.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/english_utf-8.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1757,6 +1757,7 @@
     'debug_image_upload' => "Debug Image Uploading?",
     'keep_unscaled_image' => "Keep Unscaled Image?",
     'allow_user_scaling' => "Allow User Scaling?",
+    'jpeg_quality' => 'JPEG Quality?',
     'max_image_width' => "Max Image Width?",
     'max_image_height' => "Max Image Height?",
     'max_image_size' => "Max Image Size?",
diff -r fac2f37acc57 -r 1ffedc7146eb language/german.php
--- a/language/german.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/german.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1746,6 +1746,7 @@
     'debug_image_upload' => 'Debug Image-Upload?',
     'keep_unscaled_image' => 'Bild in Originalgröße behalten?',
     'allow_user_scaling' => 'User darf skalieren?',
+    'jpeg_quality' => 'JPEG-Qualität?',
     'max_image_width' => 'Max. Bildbreite?',
     'max_image_height' => 'Max. Bildhöhe?',
     'max_image_size' => 'Max. Bildgröße?',
diff -r fac2f37acc57 -r 1ffedc7146eb language/german_formal.php
--- a/language/german_formal.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/german_formal.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1747,6 +1747,7 @@
     'debug_image_upload' => 'Debug Image-Upload?',
     'keep_unscaled_image' => 'Bild in Originalgröße behalten?',
     'allow_user_scaling' => 'User darf skalieren?',
+    'jpeg_quality' => 'JPEG-Qualität?',
     'max_image_width' => 'Max. Bildbreite?',
     'max_image_height' => 'Max. Bildhöhe?',
     'max_image_size' => 'Max. Bildgröße?',
diff -r fac2f37acc57 -r 1ffedc7146eb language/german_formal_utf-8.php
--- a/language/german_formal_utf-8.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/german_formal_utf-8.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1747,6 +1747,7 @@
     'debug_image_upload' => 'Debug Image-Upload?',
     'keep_unscaled_image' => 'Bild in Originalgröße behalten?',
     'allow_user_scaling' => 'User darf skalieren?',
+    'jpeg_quality' => 'JPEG-Qualität?',
     'max_image_width' => 'Max. Bildbreite?',
     'max_image_height' => 'Max. Bildhöhe?',
     'max_image_size' => 'Max. Bildgröße?',
diff -r fac2f37acc57 -r 1ffedc7146eb language/german_utf-8.php
--- a/language/german_utf-8.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/language/german_utf-8.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1746,6 +1746,7 @@
     'debug_image_upload' => 'Debug Image-Upload?',
     'keep_unscaled_image' => 'Bild in Originalgröße behalten?',
     'allow_user_scaling' => 'User darf skalieren?',
+    'jpeg_quality' => 'JPEG-Qualität?',
     'max_image_width' => 'Max. Bildbreite?',
     'max_image_height' => 'Max. Bildhöhe?',
     'max_image_size' => 'Max. Bildgröße?',
diff -r fac2f37acc57 -r 1ffedc7146eb public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/public_html/admin/install/config-install.php	Sun Nov 16 10:30:00 2008 +0100
@@ -228,6 +228,7 @@
     $c->add('fs_upload', NULL, 'fieldset', 5, 23, NULL, 0, TRUE);
     $c->add('keep_unscaled_image',0,'select',5,23,0,1480,TRUE);
     $c->add('allow_user_scaling',1,'select',5,23,0,1490,TRUE);
+    $c->add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
     $c->add('debug_image_upload',FALSE,'select',5,23,1,1500,TRUE);
 
     $c->add('fs_articleimg', NULL, 'fieldset', 5, 24, NULL, 0, TRUE);
diff -r fac2f37acc57 -r 1ffedc7146eb public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Sat Nov 15 23:08:35 2008 +0100
+++ b/public_html/admin/install/index.php	Sun Nov 16 10:30:00 2008 +0100
@@ -1369,6 +1369,10 @@
             break;
 
         case '1.5.1':
+            require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_1.5.1_to_1.5.2.php';
+
+            update_ConfValues();
+
             $current_gl_version = '1.5.2';
             $_SQL = '';
             break;
diff -r fac2f37acc57 -r 1ffedc7146eb public_html/docs/config.html
--- a/public_html/docs/config.html	Sat Nov 15 23:08:35 2008 +0100
+++ b/public_html/docs/config.html	Sun Nov 16 10:30:00 2008 +0100
@@ -85,7 +85,7 @@
     in the <tt>siteconfig.php</tt> file.</td></tr>
 <tr>
   <td valign="top"><a name="desc_copyrightyear">copyrightyear</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">Set this to the year you want to appear in the copyright notice of your
     site's footer. If not set, Geeklog will use the current year.</td></tr>
 <tr>
@@ -882,13 +882,13 @@
     <th style="width:63%">Description</th></tr>
 <tr>
   <td valign="top"><a name="desc_image_lib">image_lib</a></td>
-  <td valign="top">'' <i>(empty string)</i></td>
+  <td valign="top">None</td>
   <td valign="top">Set this to either 'imagemagick', 'netpbm', or 'gdlib' if
-    images should be resized during upload. Leave as '' if you don't want
+    images should be resized during upload. Leave as 'None' if you don't want
     images to be resized or if you don't have those packages available.</td></tr>
 <tr>
   <td valign="top"><a name="desc_path_to_mogrify">path_to_mogrify</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">If you chose 'imagemagick' for
     <code>$_CONF['image_lib']</code> above, then this should hold the
     <strong>complete path</strong> to the mogrify executable (from the
@@ -898,15 +898,13 @@
     (version 5.4.9 or newer is recommended).</td></tr>
 <tr>
   <td valign="top"><a name="desc_path_to_netpbm">path_to_netpbm</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">If you chose 'netpbm' for <code>$_CONF['image_lib']</code>
     above, then this should hold the complete path to the <em>directory</em>
-    where the binaries from the netpbm package are kept, e.g.
+    where the binaries from the Netpbm package are kept, e.g.
     <code>'/usr/bin/netpbm/'</code>. Note that the path must end in a slash.<br>
-    Precompiled binaries of the netpbm package for various platforms can be
-    downloaded from the <a
-    href="http://sourceforge.net/projects/gallery/">Homepage of the Gallery
-    project</a>.</td></tr>
+    Precompiled binaries for various platforms can be downloaded from the <a
+    href="http://netpbm.sourceforge.net/">Netpbm homepage</a>.</td></tr>
 </table>
 
 <h3><a name="images_upload">Images: Upload</a></h3>
@@ -927,10 +925,24 @@
     enables the <code>[unscaled<i>X</i>]</code> image tag (in addition to the
     <code>[image<i>X</i>]</code> tag).</td></tr>
 <tr>
+  <td valign="top"><a name="desc_jpeg_quality">jpeg_quality</a></td>
+  <td valign="top"><i>(disabled)</i></td>
+  <td valign="top">Control the image quality when resizing JPEGs. All the image
+    libraries supported by Geeklog are based on the IJG JPEG library which uses
+    an arbitrary range of 0-100 to specify the "quality" (note that this is
+    <em>not</em> a percent value). The default, when not set, is 75 which
+    provides good quality in most cases. In some cases, higher values may
+    provide better results.<br>
+    Rules of thumb: Values above 90 usually don't improve the image quality any
+    more but only produce larger files. Values below 50 will result in poor
+    image quality. Values of 25 and below will produce distorted
+    images.</td></tr>
+<tr>
   <td valign="top"><a name="desc_debug_image_upload">debug_image_upload</a></td>
-  <td valign="top"><i>(commented out)</i></td>
-  <td valign="top">When not commented out(!) and set to <code>true</code>, this
-    option enables debugging output to be written into Geeklog's <tt>error.log</tt> file during the upload of an image. This is useful to track down problems
+  <td valign="top"><i>(disabled)</i></td>
+  <td valign="top">When enabled and set to <code>true</code>, this option
+    enables debugging output to be written into Geeklog's <tt>error.log</tt>
+    file during the upload of an image. This is useful to track down problems
     with the image upload.</td></tr>
 </table>
 
@@ -1009,7 +1021,7 @@
     is rejected (even if you're using a graphics package to resize images).</td></tr>
 <tr>
   <td valign="top"><a name="desc_force_photo_width">force_photo_width</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">This option, when enabled, will only apply when
     <em>displaying</em> a user photo. The <code><img></code> tag for the
     user photo will be emitted with a max. width, as specified by this option.
@@ -1018,7 +1030,7 @@
     shaped user photos to break your page's layout (e.g. in a forum).</td></tr>
 <tr>
   <td valign="top"><a name="desc_default_photo">default_photo</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">When enabled, this option should point to an image (full URL
     required!) that should be displayed for users without a user photo. When
     this option is not set and a user does not have a user photo (or an avatar)
@@ -1042,7 +1054,7 @@
     a lot of userphotos for different users (e.g. forum threads).</td></tr>
 <tr>
   <td valign="top"><a name="desc_gravatar_rating">gravatar_rating</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">Avatars submitted to gravatar.com are <a
     href="http://gravatar.com/rating.php">rated</a> with the rating system used
     for movies (in the U.S.), i.e. the letters G, PG, R, or X. This option will
@@ -1069,12 +1081,12 @@
     href="#Localization">Localization</a> below.</td></tr>
 <tr>
   <td valign="top"><a name="desc_language_files">language_files</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">For multi-lingual setups only: A list mapping language
     shortcuts ('en', 'de', etc.) to the Geeklog language files to use.</td></tr>
 <tr>
   <td valign="top"><a name="desc_languages">languages</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">For multi-lingual setups only: A list mapping language
     shortcuts ('en', 'de', etc.) to the language's native name ("English",
     "Deutsch", etc.).</td></tr>
@@ -1145,7 +1157,7 @@
   <td valign="top">How many decimal places to display.</td></tr>
 <tr>
   <td valign="top"><a name="desc_timezone">timezone</a></td>
-  <td valign="top"><i>(commented out)</i></td>
+  <td valign="top"><i>(disabled)</i></td>
   <td valign="top">If your server is located in a different timezone, use this
     option to set your local (i.e. your own) timezone, so that the time and
     date on the site match your own.<br>
diff -r fac2f37acc57 -r 1ffedc7146eb public_html/docs/history
--- a/public_html/docs/history	Sat Nov 15 23:08:35 2008 +0100
+++ b/public_html/docs/history	Sun Nov 16 10:30:00 2008 +0100
@@ -3,6 +3,9 @@
 ??? ??, 2008 (1.5.2)
 ------------
 
+- Improved image quality when using gdlib to rescale images. Also added a
+  configuration option to control the JPEG quality (Feature request #0000720)
+  [Dirk]
 - Check if COM_errorLog exists before using it in the config class (for possible
   problems during installation, bug #0000768) [Dirk]
 - Fixed filling out the Site Email / No-Reply Email fields in the install
diff -r fac2f37acc57 -r 1ffedc7146eb sql/updates/mssql_1.5.1_to_1.5.2.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mssql_1.5.1_to_1.5.2.php	Sun Nov 16 10:30:00 2008 +0100
@@ -0,0 +1,17 @@
+<?php
+
+function update_ConfValues()
+{
+    global $_CONF;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    // new option
+    $c->add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
+
+    return true;
+}
+
+?>
diff -r fac2f37acc57 -r 1ffedc7146eb sql/updates/mysql_1.5.1_to_1.5.2.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/updates/mysql_1.5.1_to_1.5.2.php	Sun Nov 16 10:30:00 2008 +0100
@@ -0,0 +1,17 @@
+<?php
+
+function update_ConfValues()
+{
+    global $_CONF;
+
+    require_once $_CONF['path_system'] . 'classes/config.class.php';
+
+    $c = config::get_instance();
+
+    // new option
+    $c->add('jpeg_quality',75,'text',5,23,NULL,1495,FALSE);
+
+    return true;
+}
+
+?>



More information about the geeklog-cvs mailing list