mirror of
https://github.com/e107inc/e107.git
synced 2025-08-12 17:44:37 +02:00
Issue #4270 - perform all webp conversion checks within e_thumbnail class. WebP conversion now works with SEF media URLS.
This commit is contained in:
@@ -250,7 +250,6 @@ class e_parse
|
||||
|
||||
private $bootstrap;
|
||||
private $fontawesome;
|
||||
private $convertToWebP = false;
|
||||
|
||||
private $removedList = array();
|
||||
private $nodesToDelete = array();
|
||||
@@ -2361,11 +2360,6 @@ class e_parse
|
||||
parse_str($options, $options);
|
||||
}
|
||||
|
||||
if($this->convertToWebP)
|
||||
{
|
||||
$options['type'] = 'webp';
|
||||
}
|
||||
|
||||
if(!empty($options['scale'])) // eg. scale the width height 2x 3x 4x. etc.
|
||||
{
|
||||
$options['return'] = 'src';
|
||||
@@ -2442,9 +2436,9 @@ class e_parse
|
||||
|
||||
}
|
||||
|
||||
if(!empty($options['type']) && ($options['type'] === 'webp'))
|
||||
if(!empty($options['type']))
|
||||
{
|
||||
$thurl .= '&type=webp';
|
||||
$thurl .= '&type='.$options['type'];
|
||||
}
|
||||
|
||||
|
||||
@@ -3592,15 +3586,6 @@ class e_parse
|
||||
$this->bootstrap = (int) $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bool
|
||||
*/
|
||||
public function setConvertToWebP($bool)
|
||||
{
|
||||
|
||||
$this->convertToWebP = (bool) $bool;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add leading zeros to a number. eg. 3 might become 000003
|
||||
|
@@ -45,6 +45,8 @@ class e_thumbnail
|
||||
|
||||
protected $_upsize = true;
|
||||
|
||||
protected $_forceWebP = false;
|
||||
|
||||
/**
|
||||
* Constructor - init paths
|
||||
*
|
||||
@@ -86,6 +88,7 @@ class e_thumbnail
|
||||
|
||||
$this->_upsize = ((isset($this->_request['w']) && $this->_request['w'] > 110) || (isset($this->_request['aw']) && ($this->_request['aw'] > 110))); // don't resizeUp the icon images.
|
||||
|
||||
$this->_forceWebP = empty($this->_request['type']) && !empty($pref['thumb_to_webp']) && (strpos( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) !== false) ? true : false;
|
||||
// var_dump($this);
|
||||
// exit;
|
||||
return null;
|
||||
@@ -156,7 +159,7 @@ class e_thumbnail
|
||||
{
|
||||
$thumbnfo = pathinfo($this->_src_path);
|
||||
|
||||
if(!empty($this->_request['type']) && $this->_request['type'] == 'webp')
|
||||
if($this->_forceWebP === true || (!empty($this->_request['type']) && $this->_request['type'] == 'webp'))
|
||||
{
|
||||
$thumbnfo['extension'] = 'webp';
|
||||
}
|
||||
|
Reference in New Issue
Block a user