rosell-dk / webp-convert

Convert jpeg/png to webp with PHP (if at all possible)
MIT License
580 stars 102 forks source link

Pure PHP converter ! ? #99

Open rosell-dk opened 5 years ago

rosell-dk commented 5 years ago

WebP conversion is available in javascript.

There is libwebpjs And there is this demo, where libwebp has been compiled into javascript with emscripten.

Amazing!

But we need it in PHP. Is there any Javascript to PHP compiler out there? Yes, it seems so!: http://endel.me/js2php/

StarveTheEgo commented 5 years ago

Binary version will always be superior to PHP's one, because of native instructions I highly doubt someone would need pure js/php solution for this in production

rosell-dk commented 5 years ago

True, binary version will be much faster. However, speed isn't so important because each image only needs to be converted once. Availability is much more important. If none of the binary alternatives are available on some shared host, well, they aren't really alternatives. A converter in pure PHP will on the other side work on all platforms. This is valuable, especially for smaller sites run on shared hosts managed by non-tech people who just want things to work out of the box. Wordpress springs to mind.

mrbig00 commented 5 years ago

@StarveTheEgo it's not completely a bad idea cause the next major php version will possibly include JIT which will improve CPU intensive tasks

It is expected to make most CPU-intensive workloads run significantly faster.

JIT RFC

rosell-dk commented 5 years ago

It seems there is a copyright issue to deal with