March 2020
Intermediate to advanced
608 pages
17h 17m
English
Responsive images are powerful and, at their base, are concerned with providing different images based on media rules that indicate the features of the displays upon which each image will be shown. The first thing we did here was to add the django-imagekit app, which makes it possible to generate the different images that are needed on the fly.
Obviously, we also will need the original image source, so in our Location model, we added an image field called picture. In the upload_to() function, we built the upload path and filename out of the current year and month, the UUID of the location, and the same file extension as the uploaded file. We also defined the image version specifications there as follows: