1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Cleaned up the Default Image Size in Media-Manager Preference area. Remove 'width=' from [img] when it matches the default size.

This commit is contained in:
Cameron
2018-01-26 15:54:54 -08:00
parent 4d3ef86bb7
commit c162981fbd
6 changed files with 63 additions and 34 deletions

View File

@@ -31,11 +31,14 @@ class e_bbcode
var $preProcess = FALSE; // Set when processing bbcodes prior to saving
var $core_bb = array();
var $class = FALSE;
private $resizePrefs = array();
function __construct()
{
$pref = e107::getPref();
$this->resizePrefs = $pref['resize_dimensions'];
$this->core_bb = array(
'alert',
'blockquote', 'img', 'i', 'u', 'center',
@@ -483,21 +486,21 @@ class e_bbcode
function resizeWidth()
{
$pref = e107::getPref();
if($this->class && vartrue($pref['resize_dimensions'][$this->class.'-bbcode']['w']))
if($this->class && !empty($this->resizePrefs[$this->class.'-bbcode']['w']))
{
return $pref['resize_dimensions'][$this->class.'-bbcode']['w'];
return (int) $this->resizePrefs[$this->class.'-bbcode']['w'];
}
return false;
}
function resizeHeight()
{
$pref = e107::getPref();
if($this->class && vartrue($pref['resize_dimensions'][$this->class.'-bbcode']['h']))
if($this->class && !empty($this->resizePrefs[$this->class.'-bbcode']['h']))
{
return $pref['resize_dimensions'][$this->class.'-bbcode']['h'];
return (int) $this->resizePrefs[$this->class.'-bbcode']['h'];
}
return false;
}
@@ -672,6 +675,10 @@ class e_bbcode
$html = str_replace('"','"', $html);
}
// var_dump($this->defaultImageSizes);
$cl = $this->getClass();
$arr = $tp->getTags($html,'img');
$srch = array("?","&");
@@ -729,8 +736,10 @@ class e_bbcode
}
if($this->resizeWidth() === (int) $img['width'])
{
unset($img['width']);
}
$code_text = (strpos($img['src'],'http') === 0) ? $img['src'] : str_replace($tp->getUrlConstants('raw'), $tp->getUrlConstants('sc'), $qr['src']);