Building a full featured gallery with voting system I'm looking for a way to build a simple gallery node type in Drupal, with vote (with Votingapi and Fivestar)per image enabled. (1 vote per image, per node, per user, and users are able to vote on any image in the node).
As simple as it looks, I'm unable to build a simple proof of concept of what I'm trying to achieve.

Here's a mockup of how I see the thing, and here's how I see the thing in Drupal.
A content type 'Gallery' these following fields:


Title
Body
Field Collection (multiple):


Image (single)
Fivestar rating



I succeeded to do it and now, to compute the results, I would like to get the results per node.
However, if you look into the votingapi_vote table, the only data for a vote are:

MariaDB [voting]&gt; SELECT * FROM votingapi_vote;
+---------+-----------------------+-----------+-------+------------+------+-----+------------+-------------+
| vote_id | entity_type           | entity_id | value | value_type | tag  | uid | timestamp  | vote_source |
+---------+-----------------------+-----------+-------+------------+------+-----+------------+-------------+
|      10 | field_collection_item |         2 |    80 | percent    | vote |   1 | 1455270089 | 127.0.0.1   |
|      13 | field_collection_item |         3 |    60 | percent    | vote |   1 | 1455271926 | 127.0.0.1   |
|      15 | field_collection_item |         1 |    80 | percent    | vote |   1 | 1455272041 | 127.0.0.1   |
+---------+-----------------------+-----------+-------+------------+------+-----+------------+-------------+


It is impossible to retrieve data from the parent node because it simple doesn't exists in the DB.

It looks like we could change tags dynamically, so I hooked into fivestar to generate dynamic tags, but it gets blocked in _fivestar_cast_vote(), especially in fivestar_validate_target(), and I'm unable to generate tags dynamically.

I also tried to hook into Votingapi using hook_votingapi_preset_votes_alter() but if you're using Fivestar with the AJAX widget, it's impossible to get information on the current node using menu_get_object(). So I'm still stuck.

Now I'm trying to look for another solution, if you have ideas, please let me know.
1 vote per image, per node, per user, and users are able to vote on
  any image in the node


I don't fully understand the use case here; it might be easier to visualise the scenario with a fuller explanation?

At a guess, the issue might revolve around the use of field collection module here? I'm not a wizard at the internals of that, but personally in this situation I usually manage this with a container/item setup:


Gallery (node/entity)


Image (node/entity)
Image

Gallery


Image
Image



I then relate these either with entity_reference or I guess you could use inline entity form, depends. I don't know if there is anything that precludes you from doing it this way, but I think you're more likely to have better data from votingapi et al like this? Probably using two content types is going to give more joy than entities for that reason. 

This is all from a site builder perspective, where using this kind of setup generally means I have to write as near to zero code as possible!