I'm trying to create an image-based poll where users are able to vote between two images by clicking on them.

Any ideas?

Comments

roger.ajith’s picture

From your query i understood that you are in need of voting in images.. User Voting API & Five Star Module where you can do this thing
Also there exists one module in drupal called Photo Album that will also support voting

Hope this will help

Have a Good Day!

meishme’s picture

Thanks for the reply. I've worked with Five Star, and just checked out Photo Album. Unfortunately, they can't achieve what I intended.
What I need is a way to poll users using pictures as the actual choices.

For instance, imagine two pictures side by side: One of a Coke, and another of a Pepsi.
Users should be able to click on the image of their drink of choice, which is equal to a vote for that drink.

It should be an "either-or" setting very similar to the discontinued Smackdown module. With Smackdown, one has to manually create the choices as nodes, and then create smackdown page that references the two choices via node reference... Not ideal.

avior’s picture

Hi
I need this functionality too
an image gallery with N images and users will be able to choose only one

Did you managed doing that ?

rteijeiro’s picture

I think it could be done with the Flag and Rules modules.

I am doing the same image gallery with only one voted image possibility.

I will post some information about it when I finish it.

Kind regards.

Ruben Teijeiro
Drupal Hero

rteijeiro’s picture

I hope this little snippet will help you.

Put it on your node.tpl.php file

<?php
     global $user;
     $sql = "SELECT content_id FROM {flag_content} WHERE uid = %d AND fid = %d";                                  
     $result = db_result(db_query($sql, $user-uid, 3)); <!-- change the fid of your custom flag -->
 
    if (!$result): ?> <!-- If user haven't voted an image -->
       <div class="field-vote"><?php print flag_create_link('voted', $node->nid); ?></div>
 
    <!-- If user have voted the image that have been shown -->
    <?php elseif ($result == $node->nid): ?> <!-- Show the vote cancel link -->
       <div class="field-vote"><?php print flag_create_link('voted', $node->nid); ?></div>
    <?php endif; ?>

Ruben Teijeiro
Drupal Hero

JohnnyW’s picture

That is amazing... I tried with Versus and Smackdown and no luck.

Could you please email me or post how you did it with Flags module.... PLEEEZE :)