1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-19 04:41:53 +02:00

Preference added for thumbnail quality generated by thumb.php. Can have a dramatic effect on page-load times/performance.

This commit is contained in:
Cameron
2014-02-05 09:43:10 -08:00
parent eb83f412ab
commit 3b54047253
3 changed files with 10 additions and 2 deletions

View File

@@ -696,6 +696,8 @@ class media_admin_ui extends e_admin_ui
'image_post_class' => array('title'=> IMALAN_10, 'type' => 'userclass', 'data'=>'int', 'writeParms'=>'help=IMALAN_11&classlist=public,guest,nobody,member,admin,main,classes' ),
'image_post_disabled_method' => array('title'=> IMALAN_12, 'type' => 'boolean','writeParms'=>'enabled=IMALAN_15&disabled=IMALAN_14'),
'resize_method' => array('title'=> IMALAN_3, 'type'=>'method', 'data'=>'str'),
'thumbnail_quality' => array('title'=> "Thumbnail Quality", 'type'=>'number', 'data'=>'int', 'writeParms'=>'help=Set this as low as possible before quality loss is apparent. Max. 100'), //TODO LAN
'im_width' => array('title'=> "Avatar Width", 'type'=>'number', 'data'=>'int', 'writeParms'=>'help=Avatar images will be constrained to these dimensions (in pixels)'), //TODO LAN
'im_height' => array('title'=> "Avatar Height", 'type'=>'number', 'data'=>'int', 'writeParms'=>'help=Avatar images will be constrained to these dimensions (in pixels)'),
'resize_dimensions' => array('title'=> "Resize-Image Dimensions", 'type'=>'method', 'data'=>'str'),

View File

@@ -245,6 +245,7 @@ City, State, Country
<core name="subnews_htmlarea">0</core>
<core name="subnews_resize"></core>
<core name="themecss">canvas.css</core>
<core name="thumbnail_quality">75</core>
<core name="time_offset">0</core>
<core name="timezone">GMT</core>
<core name="track_online">1</core>

View File

@@ -70,6 +70,8 @@ class e_thumbpage
protected $_watermark = array();
private $_placeholder = false;
protected $_thumbQuality = null;
/**
* Constructor - init paths
@@ -142,6 +144,9 @@ class e_thumbpage
'shadowcolor' => vartrue($pref['watermark_shadowcolor'], '000000'),
'opacity' => vartrue($pref['watermark_opacity'], 20)
);
$this->_thumbQuality = vartrue($pref['thumbnail_quality'],65);
// parse request
$this->parseRequest();
@@ -231,7 +236,7 @@ class e_thumbpage
$thumbnfo = pathinfo($this->_src_path);
$options = $this->getRequestOptions();
$cache_str = md5(serialize($options).$this->_src_path);
$cache_str = md5(serialize($options). $this->_src_path. $this->_thumbQuality);
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
@@ -269,7 +274,7 @@ class e_thumbpage
{
$thumb = PhpThumbFactory::create($this->_src_path);
$sizeUp = ($this->_request['w'] > 110) ? true : false; // don't resizeUp the icon images.
$thumb->setOptions(array('correctPermissions' => true, 'resizeUp'=>$sizeUp));
$thumb->setOptions(array('correctPermissions' => true, 'resizeUp' => $sizeUp, 'jpegQuality' => $this->_thumbQuality));
}
catch (Exception $e)