This module enables Drupal site to search images by color.

It could be useful for photographers sites, retail stores and consist of tree submodules
This does not yet exist in drupal.org

It consists of 3 sub modules:
- color_palette to display a text field as color palette
- color_index for the actual indexing
- color_search for finding the color

Project page.
https://drupal.org/sandbox/idevit/1961874

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/idevit/1961874.git coloring

CommentFileSizeAuthor
#11 coloring.2013.12.30.23.02.04.png74.31 KBdevd

Comments

sutharsan’s picture

Thanks for sharing the code and for your project application request.
This is my result of a first runthrough of the module.

1. The main module is called 'coloring' but there is no coloring.module. All code seems to be placed in submodules. Better use one name space instead of many. Use sub module if their use is optional. So I advise to move the code from 'color_index' into 'coloring'.

2. Color Index has a dependency on 'color_palette_formatter'. That means that 'Color Index' can not work without 'Color Pallette Formatter'. I must be missing something, but I would combine both in one module. If you want to segragete code in different files, you can use diff .inc for different parts for the module.

3. If color_index.module.bck and color_index.module.bckup are working copies, please remove them from the repo.

4 code style

    if ($size[2] == 1)
    $image_orig = imagecreatefromgif($img);
    if ($size[2] == 2)
    $image_orig = imagecreatefromjpeg($img);

In this code snippet form helper_functions.inc these if() statements do not follow Drupal code style. Have you use Coder module to check the Drupal code style of you module.

5. Includes
In color_index.module:

module_load_include('inc', 'color_index', 'helper_functions');

Try to load this file only when required, this reduces the memory footprint of your module. the *.module is always loaded and parsed and thus the helper file is always loaded. Further, place a module_load_include() like this at the top of a file. This makes is more visible, and it should be.

6. namespace
The file name helper_functions.inc does not follow the color_index namespace of this module. Use color_index.inc instead.

scuba_fly’s picture

To add to Sutharsan namespace ( 6 ):
The functions in 'helper_functions.inc' are not following the namespace of this module

I found a patch in the subfolder 'patch' of the subfolder color_search_helper':
'color_picker_library.patch'
I think this file and the folder 'patch' should be removed if possible.

idebr’s picture

Status: Needs review » Needs work

Per #1 and #2, I'll update the status to 'Needs work'.

florisg’s picture

Status: Needs work » Needs review

Thank you for the suggestions and feedback,
I processed all comments.

Hope something else can be improved?

idebr’s picture

Status: Needs review » Needs work

Hi idevit (nice username btw:)),

I ran your module through the automated test environment and it found a number of issues regarding code style. You can check the report here: http://pareview.sh/pareview/httpgitdrupalorgsandboxidevit1961874git

To check your progress, you can resubmit the automated test here: http://pareview.sh/ with the input: http://git.drupal.org/sandbox/idevit/1961874.git

ndf’s picture

Hi idevit:

Improve readme
README.txt. Can you be more precise how to configure? Field must be named 'field_color'. Enable search-index, etc.

Extend search query with alternate colors
Now search looks for 1 color. The colors that hit are extracted on node_save (cool!).
Maybe you could also create a color-range on search_submit. That way you can create search-functionality like dribbble where you choose RGB, color variance and color minimum.
You can implement this in function color_search_helper_form_submit for the custom search form. First you extract a color from the search query, that color you parse and pass to the search-engine.
The search query will then be something like "#fff OR #eee OR #ddd" instead of "#eee". You might also want to alter the default search form with a hook_form_submit / hook_form_validate.

florisg’s picture

Thank you nielsdefeyter, Readme adjusted accordingly.

The search feature can indeed be improved
It will be a feature request for the module page

Thanks idebr, i updated so pareview is happy as well
One warning left in http://pareview.sh/pareview/httpgitdrupalorgsandboxidevit1961874git
This variable is used in the same calculation function and is declared on the fly.

florisg’s picture

Status: Needs work » Needs review
PA robot’s picture

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.

ram4nd’s picture

Issue tags: -Drupal.org Project Application

coloring_admin() - predefine $form to avoid notices.
Complete the review bonus.

devd’s picture

Status: Needs review » Needs work
StatusFileSize
new74.31 KB

Hi idevit,
There are some issues and notices:

Notice: Undefined index: coloring_content_types in coloring_admin_settings_submit().
Warning: Invalid argument supplied for foreach() in coloring_admin_settings_submit().

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).

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