For ICEkit Images override Django's default handling of image fields
to ensure the image dimension data calculated for the field is always
persisted to the DB, even when the Image is not saved (or intended to
be saved) by the surrounding code.
This is a fix for a situation where we essentially have bad data in the
DB for images, where they have been uploaded to the CMS but the
dimensions were not properly persisted to the DB at this time.
Without this change, sites with no image dimensions in the Image DB
records will – when an Image is accessed for read-only display –
repeatedly download the image file, recalculate dimensions of the image,
re-set the Image model's width & height field values, but then
throw away all this work because the model instance isn't subsequently
saved.
For ICEkit
Image
s override Django's default handling of image fields to ensure the image dimension data calculated for the field is always persisted to the DB, even when theImage
is not saved (or intended to be saved) by the surrounding code.This is a fix for a situation where we essentially have bad data in the DB for images, where they have been uploaded to the CMS but the dimensions were not properly persisted to the DB at this time.
Without this change, sites with no image dimensions in the
Image
DB records will – when anImage
is accessed for read-only display – repeatedly download the image file, recalculate dimensions of the image, re-set theImage
model'swidth
&height
field values, but then throw away all this work because the model instance isn't subsequently saved.