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

Trebor
  • 3,270
  • 8
  • 25
Henry
  • 415
  • 4
  • 8

3 Answers3

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.

Steve
  • 8,448
  • 23
  • 29
  • 1
    Rather use "graphicsmagick", a drop in replacement for imagemagick. – Jost May 17 '21 at 12:55
  • 1
    @Jost Why? Is it better? – wizzwizz4 May 17 '21 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 '21 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 '21 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 '21 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.

Bob Kelso
  • 21
  • 1
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.

MonkeyZeus
  • 281
  • 1
  • 6