Black image issue
I've created webp image using image/intervention. It's working perfectly on my local server but it's not working in the live server(ubuntu 160.04). But when I try to open that image it shows a blank transparent image with correct Content-Type: image/webp and file-size.
Blank image return like this: https://imgur.com/a/CMx6tsU I'm using following code to generate webp image from png/jpg:
$path = "path_of_original_png/jpg_image"; $webp_path= "path_to_save_webp_image"; $webp = Image::make($path); $webp->save($webp_path, 75);
@PatelPinal1415160 I have the same issue
@Kostyaval I've not found the solution to this problem. So I'm switching to use a "libwebp". I'm using "cwebp" to encode/decode image into WEBP. It's a wonderful tool for WEBP format which is provided by Google.
I still have the same problem - does anyone know how to fix this?
Found the solution: Reference
"Need to check if the frame length is even. If this is not the case, we append a zero byte to the end of the frame".
if (filesize($pathToFile) % 2 == 1) {
file_put_contents($pathToFile, "\0", FILE_APPEND);
}
Or just update libwebp-dev to latest version. I have this problem on 0.4.4-1, but 0.6.1-2 on local machine works fine.