rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
227 stars 64 forks source link

Serve images as JPEG2000 for Safari #294

Open widersky opened 5 years ago

widersky commented 5 years ago

As you might know, Safari doesn't support WebP for now. Did you consider to add JPEG2000 support to plugin?

kropkikreski commented 5 years ago

Yes! We would love to see JPEG2000 support for iOS and safari on mac.

rosell-dk commented 5 years ago

It is a good idea. But it requires a lot of work. And perhaps the plugin should be renamed as well. "NextGen image formats" springs to mind.

However, converting to jp2 with PHP is not well supported. It can be done by executing the Imagemagick binary. The Imagick PHP extension however does not seem to support it and neither does Gd or Vips. So the feature will only work out of the box on few systems.

I could add a new conversion method which executes the open jpeg binary as suggested here. But that method will also be based on executing a binary, which I suspect is restricted on most systems.

It seems that in order to have such conversions available to more than a few will require setting up a cloud conversion service. But as I cannot afford to provide such service for free, the task of implementing such would be significant. But perhaps we can find an existing one to connect to.

For the .htaccess, I could use conditional rewrites with the condition: RewriteCond %{HTTP_USER_AGENT} Safari similar to here