Problem/Motivation
Crop data is attached to a file through URI.
However a user is not aware of that when looking at the file itself.
Instead it is only made visible in context of the placement.
See related issues #2617820: Warn user on image reuse and #2617818: Support multiple crop variants per URI and crop type
Proposed resolution
Display crop data in context of the file. Also display cropping tool on file field widget. We can use similar approach as the one file entity takes for "Edit" (link, open dialog, crop in dialog, ...).
This can be done in 3 steps:
- See if we need to extract any of the existing code into helper functions to make it easier to put crop tool on more places.
- Add crop tool to file edit page
- Add crop tool (dialog) on file field widget
Integrate with file / file_entity to make cropping info editable when visiting the file on its own.
Remaining tasks
Discuss scope of issue.
Crop might be able to wire things and provide an entry point to the UI modules.
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#6 | Screen Shot 2015-12-01 at 16.55.14.png | 113.76 KB | sasanikolic |
#6 | Screen Shot 2015-12-01 at 16.55.01.png | 49.85 KB | sasanikolic |
Comments
Comment #2
woprrr CreditAttribution: woprrr as a volunteer commentedComment #3
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedComment #4
slashrsm CreditAttribution: slashrsm as a volunteer commentedWhen using file_entity you get the actual file edit page. Embed cropping tool into it too. File entity
Comment #5
miro_dietikerYeah agree and discussed with Berdir:
We want to have the cropping UI added to the file entity edit form.
Comment #6
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedStep to reproduce the popup:
- add a field (i.e. for Article content type)
- in form display change the widget from File to Editable file
- create an article and upload an image
- click on edit
Here are the provided screenshots.
We will integrate this into the popup after finishing this issue #2625026: Crop widget crop list not following common patterns.
Comment #7
miro_dietikerGreat.
One problem though:
The widget usually displays in context of a field and then we can limit the crop types.
For the global admin/content/files // files edit widget we can not limit the crop types..
So we either need to display all crop types for that case or only display the ones in use or allow adding a crop through a drop down button to avoid a long list of unused items if the system has many crop types setup.
I think adding more configurability is a bad idea.
Comment #8
miro_dietikerDiscussed with Sasa and Berdir:
For now we list all crop types.
Comment #9
miro_dietikerPromoting to major since this integration is needed for many ways like inline entity form or the edit button widget for file entity.
Comment #10
thenchev CreditAttribution: thenchev at MD Systems GmbH commentedhttps://github.com/drupal-media/image_widget_crop/pull/1
Comment #11
woprrr CreditAttribution: woprrr as a volunteer commentedI think this issue is now a priority for the module we need to focus our effort on that. I ve discuss with @slashrsm for an robust solution
We need to create new form element Like :
This solution i think is the best and reusable in widget element and form api (for IEF, EB, File entity).
For more details and discuss we us
@see PR on github
Comment #12
slashrsm CreditAttribution: slashrsm as a volunteer commentedThis is IWC issue.
Comment #13
slashrsm CreditAttribution: slashrsm as a volunteer commentedNew pull:
https://github.com/drupal-media/image_widget_crop/pull/3
Comment #15
woprrr CreditAttribution: woprrr as a volunteer commentedIt's ok ;) I think we do verify all changes introduces by #2641970 i ve found an call to getThumbnailCropProperties and he has deleted by this issue. It' time to refactor ;)
Comment #16
miro_dietikerI was so happy to see this committed... But now file entity integration is completely broken.
Although JS can not be tested, such an integration definitively needs a minimal test.
Please be patient with commits and rerun tests after complex potential overlaps.
Keeping HEAD stable needs to be our top priority.
Followup: Would be nice to extend the demo with a file entity dependency to make this visible. See #2653378: Add file entity to demo