Ticket #10186 (reopened Feature Request)
Add a removeImageScales function
| Reported by: | frisi | Owned by: | witsch |
|---|---|---|---|
| Priority: | minor | Milestone: | 4.x |
| Component: | Infrastructure | Version: | |
| Keywords: | blob | Cc: | pelle |
Description (last modified by witsch) (diff)
in a buildout with activated blobstorage recreating image scales in portal_atct fails with an AttributeError:
Module Products.PageTemplates.Expressions, line 227, in evaluateText Module zope.tales.tales, line 696, in evaluate - URL: manage_imageScales - Line 35, Column 3 - Expression: <PathExpr standard:'here/recreateImageScales'> - Names: {'container': <ATCTTool at /test/portal_atct>, 'context': <ATCTTool at /test/portal_atct>, 'default': <object object at 0xb77385c8>, 'here': <ATCTTool at /test/portal_atct>, 'loop': {}, 'nothing': None, 'options': {'args': ()}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xa13b30c>, 'request': <HTTPRequest, URL=http://localhost:8499/test/portal_atct/manage_imageScales>, 'root': <Application at >, 'template': <PageTemplateFile at /test/portal_atct/imageScales>, 'user': <PropertiedUser 'meister'>} Module zope.tales.expressions, line 217, in __call__ Module Products.PageTemplates.Expressions, line 157, in _eval Module Products.PageTemplates.Expressions, line 119, in render Module Products.ATContentTypes.tool.atct, line 103, in recreateImageScales Module Products.Archetypes.Field, line 2415, in createScales - __traceback_info__: (<Field image(blob:rw)>, <ATImage at /test/wm-schwarz-rgb-300dpi.png>, 'image_mini', 200, 200) Module Products.Archetypes.Field, line 2430, in _make_image AttributeError: content_class > .buildout/eggs/Products.Archetypes-1.6b2-py2.6.egg/Products/Archetypes/Field.py(2430)_make_image() -> return self.content_class(id, title, file, content_type)
to reproduce:
- create a plone site
- add an image to it
- visit plone/portal_atct/manage_imageScales
- press the recreate Button
using versions pinned in http://dist.plone.org/release/4.0a4/versions.cfg
Change History
comment:2 Changed 2 years ago by frisi
- Component changed from Archetypes to Unknown
digging a bit further:
The recreateImageScales method uses createScales of Products.Archetypes.Field.ImageField which uses the _make_image function to create the actual content object.
Overwriting _make_image to return blobls is not enough, we'd need to patch recreateImagesScales as a whole. The ExtinsionBlobField in plone.app.blob.subtypes.image or one of it's mixins should define createScales.
Maybe simply removing all the scaled versions of the image is enough, since they seem to be created the first time they are accessed in plone.app.imaging.traverse
comment:5 Changed 2 years ago by witsch
- Owner set to witsch
- Status changed from new to assigned
- Description modified (diff)
reformat for better readability...
comment:7 Changed 2 years ago by witsch
- Status changed from assigned to closed
- Resolution set to fixed
(In [34459]) borrow the test from plone.app.imaging to make sure the fix to allow recreation of image scales also works with blobs (fixes #10186)
comment:8 Changed 2 years ago by witsch
(In [34460]) use the new version of createScales directly for blob-based content, so that the monkey-patch can eventually be removed again (refs #10186)
comment:9 follow-up: ↓ 11 Changed 2 years ago by frisi
- Status changed from closed to reopened
- Resolution fixed deleted
recreating imagescales works fine now, thanks witsch!
however, we've lost one of plone.app.imagings features (or at least "pleasant side-effects):
the blob for an image scale is created and stored the first time the scale is accessed. this is especially useful in case you defined some scales that are only needed for the imagefields of a certain type (eg /image_frontpage for items displayed on the frontpage)
now that we compute and store each available scale for each image when recreating image scales we
- need some cpu power to process all images
- use disk space for scales that would never have been accessed
what if we would remove all existing scales when recreateImageScales is called? personally, i think this would be the better choice.
comment:10 in reply to: ↑ description Changed 2 years ago by do3cc
Hi witsch,
https://dev.plone.org/plone/ticket/10347
I am not at all sure if this issue is related, but this behaviour also occurs with p.a.b b14
Also, as mentioned there, this does not happen with all images.
Maybe it is, if so, I hope it helps
comment:11 in reply to: ↑ 9 Changed 23 months ago by witsch
Replying to frisi:
however, we've lost one of plone.app.imagings features (or at least "pleasant side-effects):
right. that "side-effect" will be back with the new image scale implementation, though. please allow a few more days for polishing and making releases and give that a try. most of the invalidation issues should turn into no-issues with that...
what if we would remove all existing scales when recreateImageScales is called? personally, i think this would be the better choice.
+1, except that the method would need to be named removeImageScales then... ;)
comment:12 Changed 23 months ago by frisi
cool, eagerly waiting for the new release w/ more flexible tag generation ;-)
comment:13 Changed 23 months ago by davisagli
- Priority changed from major to minor
Reducing priority as the main issue here is already fixed.
comment:14 Changed 19 months ago by hannosch
- Summary changed from recreateImageScales fails with plone.app.blob.subtypes.image to Add a removeImageScales function
- Type changed from Bug to Feature Request
- Milestone changed from 4.0 to 4.x
The main issue here is solved. This is a feature request for a new removeImageScales function now.
