Comment #3 on issue 299 by
aiyapan....@gmail.com: Webp image can't open
https://bugs.chromium.org/p/webp/issues/detail?id=299#c3My full code of convert jpg to webp is below,
In this case, some images seems to be crashed and some images are display well at the time of run this page. Again i reload the page previously display images also crashed.
$images = array('fb_instant.jpg','Lighthouse.jpg','Penguins.jpg','Sample Jpeg Image.jpeg');
foreach ($images as $value) {
$file = 'images/'.$value;
$file_extension = pathinfo($file, PATHINFO_EXTENSION);
$file_name = basename($value, '.'.$file_extension);
$image= imagecreatefromjpeg($file);
ob_start();
imagejpeg($image,NULL,100);
$cont= ob_get_contents();
ob_end_clean();
imagedestroy($image);
$content = imagecreatefromstring($cont);
imagewebp($content,'images/webp/'.$file_name.'.webp');
imagedestroy($content);