Open stiefenswiegel opened 2 years ago
In case you are using ImageSpecField
in your model, this could be a workaround:
from imagekit.cachefiles import ImageCacheFile
def generate_temp_images(obj):
for attr in dir(obj):
try:
val = getattr(obj, attr)
if isinstance(val, ImageCacheFile):
val.generate(force=True)
except:
pass
As a note, the value of fields with ImageSpecField
type are determined by ImageSpecFileDescriptor
descriptor returning ImageCacheFile
objects. So, we can use the value of these fields to generate our temp files.
Hi,
i would like to generate all temp image sin a postsave command. How can i generate the images for a specific instance?