mirror of
https://github.com/e107inc/e107.git
synced 2025-08-15 02:57:15 +02:00
Issue #4270 On-the-fly conversion to WebP format with fallback for older browsers when using toImage().
This commit is contained in:
@@ -986,6 +986,21 @@ while($row = $sql->fetch())
|
||||
$result5 = $this->tp->toImage($src, ['type'=>'webp']);
|
||||
$this->assertStringContainsString('&type=webp', $result5); // src
|
||||
|
||||
$this->tp->setConvertToWebP(true);
|
||||
$result6 = $this->tp->toImage($src);
|
||||
$tempDir = str_replace(['C:','\\'],['','/'],sys_get_temp_dir()).'/'; // FIXME
|
||||
|
||||
$expected = '<picture>
|
||||
<source type="image/webp" srcset="'.$tempDir.'thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=80&h=80&type=webp">
|
||||
<source type="image/webp" srcset="'.$tempDir.'thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=320&h=320&type=webp 4x">
|
||||
<source type="image/jpeg" srcset="'.$tempDir.'thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=320&h=320 4x">
|
||||
<img class="img-responsive img-fluid" src="'.$tempDir.'thumb.php?src=e_PLUGIN%2Fgallery%2Fimages%2Fbutterfly.jpg&w=80&h=80" alt="butterfly.jpg" width="80" height="80" />
|
||||
</picture>';
|
||||
|
||||
$this->assertSame($expected,$result6);
|
||||
$this->tp->setConvertToWebP(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testThumbSrcSet()
|
||||
|
Reference in New Issue
Block a user