Hey,
I've got Color Field in my "Colors" vocabulary.
This module provides a very user-friendly interface for setting the color value, but the color swatch in the entity page itself looks... well, not that nice:
Edit mode View mode

What I want to do is generate the image based on this color value. And then set this image to the Image Field added to this vocabulary:
illustration

So far, I didn't find a way to do this. I believe, Rules is the only module that can automatically set field value based on some other field value. But I can't find an appropriate action for my specific task.
Actually, I didn't find any action for generating an image itself.

Could anyone help, please?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lex-DRL’s picture

Issue summary: View changes
Lex-DRL’s picture

Issue summary: View changes
Lex-DRL’s picture

Issue summary: View changes
FileSize
19.48 KB
4.46 KB
TR’s picture

Status: Active » Fixed
Issue tags: -build image, -image field, -image field

Rules provides you with a way to conditionally execute actions, when an event happens. In this case, creating an image is not something that is (and not something that could be) integrated into core Rules - you would have to program your own action. PHP provides the GD library for image creation and manipulation, and it would be simple to write a small Rules action to generate a uniform color image given the RGB values. You could then use that custom action in your Rule to create the image, then use the "Set a data value" action provided by Rules to set the value of the image field to point to your image. There is lots of Rules documentation on how to create custom actions, and lots of PHP documentation on the GD library, including examples.

TR’s picture

Status: Fixed » Closed (fixed)