collective / plone.app.imagecropping

Crops Images in Plone manually using cropper JS library
https://pypi.python.org/pypi/plone.app.imagecropping
9 stars 23 forks source link

When the image of a DX content type is updated, old crops are not purged (1.x) #54

Open pysailor opened 10 years ago

pysailor commented 10 years ago

I noticed this while working on tests for DX:

IF a DX-based image type (e.g. Image from p.a.contentypes) has cropped scales AND the image item is edited through the edit form, replacing the old image THEN the cropped scales still contain the former image (in cropped version).

The test test_modify_context in _testcropping.py that checks this for AT mentions #21. This in turn mentions plone/plone.scale#3 and plone/plone.scale#4. So I'm not quite sure what the current status of development is, and whether plone.scale or p.a.imagecropping should take care of nuking the old cropping info when the image is replaced.

Example screen shot: screen shot 2014-09-22 at 13 48 34

jensens commented 10 years ago

Confimed, we found this one too. Two days ago.

frisi commented 10 years ago

i tried to pin plone.scale to 1.3.4 but this did not help. we'll need to find out where the difference to archetypes and which component handles the invalidation of the old scales there. (my first guess would be the plone.app.imaging traverser - maybe it handles at differently than the plone.namedfile one (i also saw that this one does not implement the full interface in https://github.com/collective/plone.app.imagecropping/commit/decfa62e4a994210bc635e457052f5f24c87f105)

frisi commented 10 years ago

i started a branch for investigating this (https://github.com/collective/plone.app.imagecropping/tree/54-modify-image) and also tested this on a local buildout.

while doing so i made some strange observations:

a) since factoring out the at testcase to test_modify_image it also fails

b) doing local testing using the buildout of plone.app.imagecropping (including testing.zcml for the dexterity test-type) everything worked as expected

1) create ATImage (plone/image/) and upload a picture 2) visit plone/image/@@images/image/thumb shows uncropped thumb 3) visit plone/image/@@croppingeditor and crop the image 4) visit plone/image/@@images/image/thumb shows cropped thumb 5) visit plone/image/edit and upload another image 6) visit plone/image/@@images/image/thumb shows uncropped version of the new image

you can basically do the same with the dexterity-test type

1) plone/++add++dexterity_content_type_with_two_image_fields 2) upload 2 images 3) crop thumb scale 4) visit plone/test/@@images/first_image/thumb 5) upload another image for field1 6) visit plone/test/@@images/first_image/thumb and see uncropped version of the newly uploaded image

can't find the difference between the testcase and my manual tests though

jensens commented 10 years ago

so it works with DX and fails with AT in the test case and vice versa with manual clicking?

frisi commented 10 years ago

so it works with DX and fails with AT in the test case and vice versa with manual clicking?

no - both tests fail dx and at manual testing as described above works for both

jensens commented 8 years ago

this one is solved on 2.x for DX and Plone 5