public function getHtml() {
$srcset = ($this->smileyPath2x) ? ' srcset="' . StringUtil::encodeHTML($this->getURL2x()) . ' 2x"' : '';
- $style = ($this->getHeight()) ? ' style="height: ' . $this->getHeight() . 'px"' : '';
+ $height = ($this->getHeight()) ? ' height="' . $this->getHeight() . '"' : '';
- return '<img src="' . StringUtil::encodeHTML($this->getURL()) . '" alt="' . StringUtil::encodeHTML($this->smileyCode) . '" class="smiley"' . $srcset . $style . '>';
+ return '<img src="' . StringUtil::encodeHTML($this->getURL()) . '" alt="' . StringUtil::encodeHTML($this->smileyCode) . '" class="smiley"' . $srcset . $height . '>';
}
}
// enforce database values for src, srcset and style
$element->setAttribute('src', $smiley->getURL());
- if ($smiley->getHeight()) $element->setAttribute('style', 'height: ' . $smiley->getHeight() . 'px');
- else $element->removeAttribute('style');
+ if ($smiley->getHeight()) $element->setAttribute('height', $smiley->getHeight());
+ else $element->removeAttribute('height');
if ($smiley->smileyPath2x) $element->setAttribute('srcset', $smiley->getURL2x() . ' 2x');
else $element->removeAttribute('srcset');
// enforce database values for src, srcset and style
$element->setAttribute('src', $smiley->getURL());
- if ($smiley->getHeight()) $element->setAttribute('style', 'height: ' . $smiley->getHeight() . 'px');
- else $element->removeAttribute('style');
+ if ($smiley->getHeight()) $element->setAttribute('height', $smiley->getHeight());
+ else $element->removeAttribute('height');
if ($smiley->smileyPath2x) $element->setAttribute('srcset', $smiley->getURL2x() . ' 2x');
else $element->removeAttribute('srcset');