This module aims to provide advanced properties on images that can be computed automatically. Properties are stored in a field which is composed of plugins defining individual properties and declaring a method to compute the value from an image or from other already computed properties (luminosity can be computed from average color, saved MEM and CPU). The source image is taken from any image field which can be configured on the field config form.

Initially the following properties are provided:

- Color tone (average color)
- Luminosity (average of average color RGB components)

The field values can be used by other modules or themes, for example a theme could use the luminosity property to control the color of a text overlay on top of an image (original motivation to create this module).
A field formatter does not exist yet, it might not be totally necessary to have one.

Currently it includes the option to show color widgets with jQuery MiniColors (included with composer) or the build-in 'color' field type. This was an experimental move, integration with https://www.drupal.org/project/jquery_minicolors would be better, probably.

I could not find any module which does this.

Instructions

  • Add an "Image properties" field to an entity with at least one image field.
  • On the field configuration form select the image field you wish to auto-generate the image properties for.
  • Configure the field widget on the Manage form display page.

Project page (which also features a screenshot of the field widget)

https://www.drupal.org/sandbox/protostruct/2830338

Git clone command

git clone --branch 8.x-2.x https://git.drupal.org/sandbox/protostruct/2830338.git image_properties

Comments

protostruct created an issue. See original summary.

protostruct’s picture

Issue summary: View changes
protostruct’s picture

Issue summary: View changes
protostruct’s picture

Issue summary: View changes
PA robot’s picture

Issue summary: View changes

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.

protostruct’s picture

Issue summary: View changes
jabastin arul’s picture

Please review your code on "https://pareview.sh" site. We found some issue in your code. Here I have attached the link for your error code.

https://pareview.sh/node/161

jabastin arul’s picture

Status: Needs review » Needs work
protostruct’s picture

Thank you!
I've done the coding style fixes.

The one remaining ERROR is wrong in my opinion, I can see throughout core that Annotation attributes use underscore convention. Or did they change the convention?

wim leers’s picture

Status: Needs work » Needs review

Interesting module :)

The one remaining error is indeed mistaken if it's for an annotation, annotation attributes must use underscores.

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpsgitdrupalorgsandboxprotostruct2830338git

I'm a robot and this is an automated message from Project Applications Scraper.

protostruct’s picture

Status: Needs work » Needs review

Yes, the bot does not know about the annotation error....

sajiniantony’s picture

Status: Needs review » Needs work

Hello,
In the file src/Plugin/Field/FieldWidget/ImagePropertiesDefaultWidget.php line no:120,t() calls should be avoided in classes, you can use $this->t() instead.

klausi’s picture

Status: Needs work » Needs review

That is a good tip but on its own surely not an application blocker. Anything else that you found or should this be RTBC instead?

protostruct’s picture

Issue summary: View changes

Thanks! Not only src/Plugin/Field/FieldWidget/ImagePropertiesDefaultWidget.php.
I changed to $this->t() where possible.

andor.koza’s picture

Status: Needs review » Reviewed & tested by the community

Automated Review

https://pareview.sh/node/161 Found some errors and warnings, but as the others said those shouldn't be a problem.

Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage

Didn't find any issue by myself. On thing though is that when you install the minicolors library with composer the files are in the vendor folder and you manually need to copy them into the libraries folder to make it work properly. So you should describe this in the project description or change the libraries.yml file to use the minicolors library from the vendor folder.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

protostruct’s picture

Yes, I found that all libraries (composer type "drupal-library") go into vendor unless I specify the following in the composer.json:

{
  ...
  "extra": {
    "installer-paths": {
      ...
      "web/libraries/{$name}": [ "type:drupal-library" ],
      ...
    },
  ...
}

That always solved it for me, but maybe not the proposed solution?

Thanks alot for your reviews!!

protostruct’s picture

Is there anything else I need to do to promote to full project? I can't find the option on the edit page...

poojasharmaece’s picture

Hi protostruct,
Please follow https://www.drupal.org/node/2765201 to make sure its a Individual user account.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Reviewed & tested by the community » Fixed

Thank you for your contribution!

I updated your account so you can opt into security advisory coverage now.

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!

Thank you, 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 go the dedicated reviewer(s) as well.

avpaderno’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.