Skip to content

Rendition purging

The Wagtail thumbnailing mechanism uses the term 'rendition' to describe optimised images created dynamically from source images. These are used all over the site, most noticeably in 'cards' representing pages.

Occasionally, renditions created from collection images (and therefore used on collection page cards) are corrupt in some way (i.e they render but look iffy) or based on a corrupted source collection image.

In this scenario, it's desirable to delete the renditions associated with the specific CustomImage(s) in question. They will then be regenerated automatically (and hopefully successfully) the next time the templating is viewed.

There is currently no handy back-end way of doing this but it can be done programmatically.

The simplest way is to get the instance of CustomImage, fetch its renditions, then loop through them and call delete() on each rendition.

Current methods

Please add to this list...(command to target artwork, etc?)

Purge artwork renditions

"""
Deletes all renditions of master_image for any instance of 
a specified ArtworkPage  

Accepts ArtworkPage acno as string
"""

python3 manage.py purge_artwork_renditions "T14172" 

Purge archive renditions

Deletes approx 10 renditions per second on prod with feedback

"""
Deletes all renditions of master_image for any instance of 
ArchiveItemPage under a specified ArchivePage  

Accepts ArchivePage acno as string
"""

python3 manage.py purge_archive_renditions "TGA 20204/1/2"