Part of this question is already solved with another stackoverflow question but it seems that it doesn't clean up everything.
The steps are:
zeopack
with 0 daysSo the question is: how can one remove also this scaled images from blobstorage?
I tried running zeopack
twice without success, the scaled blob is still around.
UPDATE: as vangheem
pointed out, that does not happen for Archetypes Image
content types. Still, this question remains valid, as for a Dexterity-based content types that have an image field.
The scales are only removed if you remove the document, which is not my use-case, I just want to remove the image (image credits have expired and the image can not be shown anymore).
Found it!
To remove the scales you actually have to remove the plone.scale annotation:
# assume 'document' is a Dexterity-based content type that has a NamedBlobImage field
from zope.annotation.interfaces import IAnnotations
annotations = IAnnotations(document)
if 'plone.scale' in annotations:
del annotations['plone.scale']
if getattr(document, 'image', None) is not None and document.image is not None:
del document.image
document.reindexObject()