mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Issue #4270 - WebP on-the-fly conversion. Fix blurry image and include class for styling.
This commit is contained in:
@@ -4774,9 +4774,8 @@ class e_parser
|
||||
{
|
||||
$parm['type'] = 'webp';
|
||||
$source = $tp->thumbUrl($file,$parm);
|
||||
$html = "<picture>\n";
|
||||
$html .= '<source type="image/webp" srcset="'.$source.'">';
|
||||
$html .= "\n";
|
||||
$html = "<picture class=\"{$class}\">\n";
|
||||
|
||||
if(!empty($parm['srcset']))
|
||||
{
|
||||
list($webPSourceSet,$webPSize) = explode(' ', $parm['srcset']);
|
||||
@@ -4786,6 +4785,9 @@ class e_parser
|
||||
$html .= "\n";
|
||||
$srcset = ''; // remove it from the img tag below.
|
||||
}
|
||||
|
||||
$html .= '<source type="image/webp" srcset="'.$source.'">';
|
||||
$html .= "\n";
|
||||
}
|
||||
|
||||
$html .= "<img {$id}class=\"{$class}\" src=\"".$path."\" alt=\"".$alt."\" ".$srcset.$width.$height.$style.$loading.$title." />";
|
||||
|
@@ -990,10 +990,10 @@ while($row = $sql->fetch())
|
||||
$result6 = $this->tp->toImage($src);
|
||||
|
||||
|
||||
$expected = '<picture>
|
||||
<source type="image/webp" srcset="thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=80&h=80&type=webp">
|
||||
$expected = '<picture class="img-responsive img-fluid">
|
||||
<source type="image/webp" srcset="thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=320&h=320&type=webp 4x">
|
||||
<source type="image/jpeg" srcset="thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=320&h=320 4x">
|
||||
<source type="image/webp" srcset="thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=80&h=80&type=webp">
|
||||
<img class="img-responsive img-fluid" src="thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=80&h=80" alt="butterfly.jpg" width="80" height="80" />
|
||||
</picture>';
|
||||
|
||||
|
Reference in New Issue
Block a user