2

Does anyone know if images can be converted at the server-level? We have hundreds of thousands of images - mostly in jpeg format. My question is: can the images (that are uploaded to our Amazon server) be converted there and then? The format I am interested in using would be something like Webp - so the conversion would be JPEG > WEBP

3 Answers 3

3

The answer to your question is "yes".

Assuming you have your own custom site with your own code written in PHP, you would use something like https://imagemagick.org or https://github.com/free-open-source/php-image-converter (I have no connection - found by doing a basic search).

There are many other options, you would need to do your own research to find out which suits your site.

5
  • 1
    Rather use "graphicsmagick", a drop in replacement for imagemagick.
    – Jost
    May 17, 2021 at 12:55
  • 1
    @Jost Why? Is it better?
    – wizzwizz4
    May 17, 2021 at 16:58
  • 1
    Technically speaking it may be any suitable programming language, not only PHP, though PHP is very common of course. The point is about having your own code.
    – Gherman
    May 17, 2021 at 18:35
  • @wizzwizz4: It is faster and more consistent, especially over versions. The CMS TYPO3 can use both imagemagick and graphicsmagick, and you need to set a ton of options depending on the imagemagick version, whereas graphicsmagick just works with the one built in configuration.
    – Jost
    May 17, 2021 at 19:04
  • Aside: "you would use something like" - You don't necessarily need an external library if using PHP. PHP has the necessary functions built-in (GD/Image library). The Github repository linked here is actually just a wrapper for the standard PHP functions.
    – MrWhite
    May 20, 2021 at 18:58
2

Since you are posting on webmasters, I assume that your server is hosting your backend with some "web-based" language.

Since Nodejs seems the most popular, I suggest you to look at Sharp.

You can also use the Nodejs AWS SDK to make it in one script: documentation

As @Steve said, there is a lot of options here. You have to be more specific on your question.

2

If your AWS instance is just a storage node then you would need a processing server which can download the image, convert it, and upload it back to AWS.

If your AWS instance does more then you can use a backend programming language to make the conversions.

How are the images being uploaded exactly? If people are using FTP directly then you'll need to schedule a scan of your server to convert stuff to webp.

If the images are being uploaded through a front-end like WordPress then you need to program WP to convert the images before uploading them. Albeit, you will still have to figure out a solution for existing images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.