Optimized Images on your Website

Flask location block

In this guide we assume a media URL will look like this:

image source URL, green=path, red=name of image, blue=parameters
Flask location

Re-encoding, resizing and caching

Now we create a function, which will generate an image with the requested specifications from the original and save it to a caching path, which the function then will return.

Server: generate new image

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store