1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-15 02:57:15 +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:
Cameron
2021-06-18 09:31:45 -07:00
parent 7302803a75
commit c4f76c3687
4 changed files with 6 additions and 41 deletions

View File

@@ -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';
}