Project description :
Provides an interface for using the features of the Crop API. This widget provide an UX for use a crop on all fields images. This module have particularity to purpose capability to crop the same image by 'Crop type' configured. It's very usefull for editorial sites or media management sites.
By example if you have same image in 3 differents emplacement provide by same field image. You can specify on the rendered view_mode the image style to display this field image but if you have 3 formats ratio different your image have chance to destroy with classic image scale and crop.
You have a chance to loose a part of your subject in the picture, with ImageCropWidget you can specify by image style (can group by Crop Type) a specific crop.
Installation and Configuration
Installation
Download and install the image_widget_crop module as normal. Just like other modules. Install modules on "sites/all/contrib/module/" crop."
Try demo module
You can Test ImageWidgetCrop in action directly with the sub-module "ImageWidgetCrop examples" to test differents usecase of this module.
ImageWidgetCrop Code Quality
SensioLabsInsight
Scrutinizer
Travis-ci
Requirements
Module Crop API.
For ImageWidgetCrop Examples : Read readme.md.
Configuration
@See Drupal Media d8 guide.
https://drupal-media.gitbooks.io/drupal8-guide/content/modules/image_wid...
Sandbox project page link:
https://www.drupal.org/sandbox/woprrr/2571403
Pareview results:
http://pareview.sh/pareview/httpgitdrupalorgsandboxwoprrr2571403-0
To clone the project:
git clone --branch 8.x-1.x http://git.drupal.org/sandbox/woprrr/2571403.git image_widget_crop
cd image_widget_crop
Manual reviews of other projects :
https://www.drupal.org/node/2595851#comment-10502500
https://www.drupal.org/node/2368123#comment-10735792
https://www.drupal.org/node/2604294#comment-10594692
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | coder-results.txt | 3.31 KB | klausi |
| ImageWidgetCrop.png | 759.07 KB | woprrr | |
| #12 | iwc_logo.png | 21.68 KB | woprrr |
Comments
Comment #2
woprrr commentedComment #3
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxwoprrr2571403git
Fixed the git clone URL in the issue summary for non-maintainer users.
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
woprrr commentedComment #5
woprrr commentedComment #6
woprrr commentedComment #7
PA robot commentedFixed the git clone URL in the issue summary for non-maintainer users.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #8
woprrr commentedComment #9
woprrr commentedComment #10
woprrr commentedComment #11
woprrr commentedComment #12
woprrr commentedComment #13
woprrr commentedComment #14
woprrr commentedThis module is now fully ready and test in two site (1 in production environnement). I need some Tester for pass in fullProject. You can now enable a sub module 'ImageWidgetCrop Examples' for test this module easily.
Thanks for your support.
Comment #15
woprrr commentedComment #16
vpeltot commentedHi woprrr
I focused my first code review in your hook_entity_presave implementation.
1. Image widget service
Why are you call the image_widget_crop.manager service in each iteration of the foreach ?
It would be better to move this piece of code outside the foreach.
2. Route parameter
Why you check the 'edit' value in route parameter ?
If I understand, you would know if the current saving request comes from an edit form, is that right ?
You can use $entity->isNew() to check that.
3. Multiple value
Your module works fine with contents containing an image field with a number of value equals to 1.
I tried to add a field with multiple value, Only the first crop is saved.
In this hook_entity_presave, this code is the cause
You must iterate on all field value.
You must handle these cases :
Comment #17
vpeltot commentedComment #18
woprrr commentedHi @vpeltot, First THANK LOT !! for your precious returns :)
I respond point by point :
1. Image widget service : The image_widget_crop.manager service is call in each itteration is true But, he does not spend much time in this loop, it passes over x field_image using image_widget_crop different. But especially not by elements present in the field. In most cases therefore one time or 2 times (because if your need to crop two different images increase cardinality and it work).
2. Route parameter : It's TRUE !! Thanks : ) I ve changed it now is good you can confirm this :) ?
3. Multiple value : Right ! After my big refactor i ve forget to test this case again ! Now in my new commit i ve fix this feature and améliorate the javascript. I adapt the message to specify the filename of image modified in addition to the information of cropType.
For realize this is required to add a loop after parse all Crop values. (Why ? getFields() is an array map and table contains as many as there are fields). If we need to delete this loop we need to create another widget to cardinality unlimited, I thinks is bad, if we need add this foreach to manage all feature is better way.
Comment #19
woprrr commentedComment #20
vpeltot commentedNice !
I watched the rest of your code. Everything seems good !
Just one thing, I found a bug by following this steps :
Paf, previously selected crop zones are disapeared !
Maybe javascript ?
Comment #21
woprrr commentedHi vpeltot, no it s normal the ajax form refresh all element and use a stopPropagation for stop all javascript element the normal way is add your images and after crop your zone. If you need add an image in edit mode you can but add your images and after crop.
Comment #22
woprrr commentedHello, The latest version with the widget is 100% compatible and debug (JS level also unlimited cardinality mode).
Thank you to you for this review @vpeltot :)
Also merge slide by using default that appears never to have a case where there is an empty area.
Thanks all for your time :)
Comment #23
woprrr commentedComment #24
woprrr commentedComment #25
woprrr commentedComment #26
woprrr commented@Vpeltot now is Ok for your case (https://www.drupal.org/node/2573087#comment-10508480).
I also improve the detection of elements saved even if the item has not yet submitted, allowing to have saved on the line corresponding to the crop even in case the user adds other slides. This allows not to lose the selections but also to clearly identify the areas already treated.
Thanks :).
Comment #27
woprrr commentedComment #28
woprrr commentedUpdate processed in project :), The activity in Issue queu is good ready to became full project ...
Comment #29
chandrasekhar539 commentedHi woprrr,
please fix the errors in parreview
Manual Review:
Individual user account: Follows
No duplication: See #4
Master Branch: Follows
Licensing: Follows
3rd party assets/code: N/A
README.txt/README.md: Follows
Coding style & Drupal API usage:
Automated review: errors
Comment #30
woprrr commentedThanks After my refactor I ve use JSLint, now i am based ok ESlint. Thanks :) is correct now see pareview. The last codespell on yml is not an coding error and generated by drupal.
Comment #31
woprrr commentedCurrently we're thinking already has a version of "standardization" and a second existing reprennand more "exotic". I think the sandbox should move as quickly as possible to enable the project to the Media team to work more simply via DO
Comment #32
woprrr commentedWe have change a lot of concepts in this module during Media week long. Media team have work on version more standard in first time and purpose an "complex" UI like old version after.
@see https://www.drupal.org/node/2625026
Comment #33
klausiRemoving review bonus tag, you have not listed any reviews in the issue summary? Make sure to read through the source code of the other projects, as requested on the review bonus page.
Comment #34
woprrr commentedComment #35
woprrr commented@klausi I ve add my other reviews, I participate a lot in media feature on D8 ( i maintain Crop_api / IWC ) and i help in IEF.
I have not had much time for other projects but I made the best to promote this one is very expected in fullproject everything is ok now?
Comment #36
woprrr commentedComment #37
klausiReview of the 8.x-1.x branch (commit 2b27b12):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But that are not critical application blockers, otherwise looks good to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to Dave Reid as he might have time to take a final look at this.
Comment #38
woprrr commentedFor pareview return ATM we don't have choose, we need to use eval() we process an large refactor and clean up of js / php calculation architecture (@see https://www.drupal.org/node/2641970 ).
The answers to these questions lies in the doccumentation page dedicate a drupal-media ( https://drupal-media.gitbooks.io/drupal8-guide/content/modules/image_wid... ). I'll add a link to this doccumentation and would make a doc about DO
Fixed.
Fixed.
Fixed @klausi Thanks a lot.
In ImageWidgetCropManager we have any /Drupal call, in ImageCropWidget class is obligatory in static méthod. process method is defined static in core we can change it to inject our code. In github we have an issue to transform all element define in process into new form element ( @see https://github.com/drupal-media/image_widget_crop/pull/1#issuecomment-17... ).
It's same, i process scrutinizer analyze and he require an @return array instead double[].
We need to be sure to be in an editing context of an entity when we access a process().
Fixed.
Fixed. ( We have a real gain? Can you explain to me or give me a doc about the difference? )
For the two remaining points I create a way to fix that.
Thanks a lot @klausi !
Comment #39
slashrsm commentedOne \Drupal::service() call is in static function, but the other is not. Also, deprecated entity.manager is still used in one of them. Would be great to check entire module for usages of entity manager.
Drupal standard is double[].
I agree with @klausi that this isn't the nicest solutions. Why can't we simply try to load? If nothing comes back it is obvious that there is no crop for the image. But I also agree that it is not critical. Specially considering the fact that we're planning to refactor this part significantly. As @woprrr already mentioned we're planning to convert cropping tool to a decoupled form element. We will fix this kind of problems along the way.
Unrelated to stuff above.... This module has already been adopted by Media initiative. It has a copy in drupal-media group on Github and it following our standard development process. We invested significant amount of time into it in past few months. It was one of the focuses at Zurich media sprint, that happened in December.
It was great to work with @woprrr. He is very open for other ideas, very collaborative, responsive and open for suggestions. All this will make him a great module maintainer.
This is good to go as far as I am concerned. I am pretty sure everyone in the initiative that worked on this module (many people!) agree with me.
Comment #40
klausiOK, I think another RTBC from @slashrsm is enough to approve this.
Thanks for your contribution, woprrr!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.