How To Use WebP Images on Azure WordPress Managed Offering

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

  • In your WordPress Managed offering, go to webssh of your SCM site -  https://<app name>.scm.azurewebsites.net/webssh/host
  • Install the GD extension with Webp support using the below command.

apk add --no-cache --virtual .build-deps autoconf pkgconfig gcc g++ gawk make zlib-dev libpng-dev libwebp-dev \

&& docker-php-ext-configure gd --with-webp \

&& docker-php-ext-install gd \

&& apk del .build-deps

Copy the newly installed gd.so file to a persistent file storage.

mkdir -p /home/dev/extensions

cp /usr/local/lib/php/extensions/no-debug-non-zts-20200930/gd.so /home/dev/extensions/gd.so

 

  • Now write a post-startup script to restore the updated copy of gd.so everytime the app starts.

Edit the startup script file in /home/dev directory using the below command: 

vi /home/dev/startup.sh

Then add the following command to the startup.sh file and save it (type :wq to save).

 

cp /home/dev/extensions/gd.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/gd.so 

 

  • Now restart your app from Azure Portal and you can upload a sample .webp image to test the changes.

 

Arjun_Baliga_0-1680789067846.png

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.