Django - Image post processing on save -
if want able "post process" image after uploaded, crop down size , apply compression. stands, doing using post_save signal, when model saved, accessing file, applying post production , saving on original.
i doing when created argument of post save signal set true avoid unnecessary image processing every time model updated.
the problem
when image field of existing instance updated, post processing of image being skipped because created flag false.
how can setup model apply post processing image when imagefield has changed, if model created? this app may not used django admin, overwriting imagefield_save method isn't going work.
hope can help!
this question long time ago, not actual anymore?
did have at:
pre_save.connect(before_mymodel_save, sender=mymodel)
have @ the signal documentation of django
you create function before_mymodel_save , can try in there. if you're using save inside post or pre save functions: make sure disconnect signal if save mymodel object within function (and connect again), avoid endless loops.
Comments
Post a Comment