Add star rating to album's thumbnail view? Add star rating to album's thumbnail view?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Add star rating to album's thumbnail view?

Started by Colliope, June 14, 2007, 01:14:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Colliope

Theme Fruity, In Config I have it set to show image Title and number of views below the thumbail inside albums.
Is there a mod (easy hopefully) to add the rating that photo has? Either the graphic depiction of 1-5 stars, or the 5/5 ratio or something?
The only way to see ratings now is to click on the thumb and view the image full-size, or use "show top rated".  It would be nice to be able to open an album and quicklyy see what's been rated without having to click on each thumb to check.

Thanks,

C

Nibbler

#1
include/functions.inc.php, search for


                // Set picture caption
                if ($set_caption) build_caption($rowset);


and change it to


                // Set picture caption
                if ($set_caption) build_caption($rowset, array('pic_rating'));


Also, change

if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';

to

if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name, votes, pic_rating';

To hide pics with no ratings, change

            $caption .= "<span class=\"thumb_caption\">".'<img src="'.$prefix.'images/rating'.round($row['pic_rating']/2000).'.gif" alt=""/>'.'<br />'.sprintf($lang_get_pic_data['n_votes'], $row['votes']).'</span>';


to

            if ($row['votes']) $caption .= "<span class=\"thumb_caption\">".'<img src="'.$prefix.'images/rating'.round($row['pic_rating']/2000).'.gif" alt=""/>'.'<br />'.sprintf($lang_get_pic_data['n_votes'], $row['votes']).'</span>';

Colliope

Great! That looks like a real easy change. Can you tell me what it'll add? The star graphic like displayed on the "top rated" page?

Thanks,
C

Colliope

OK I just went ahead and changed it. It displays the star graphic and the number of votes below that. Nice.

Would there happen to be a line of code that can be added/changed to make it show only for pics that actually have votes?

C

Colliope

Hmmm. I should have looked closer at the change it made. It shows 5 empty stars for everything instead of showing them appropriately colored in red according to the rating the image has. I un-did the change and think I'll just leave it as it unless you have another suggestion to try.  Thanks,

C

Nibbler


Colliope

OK, I'll try it again. I need to change all three lines of code right, not just the latest one?

Thanks,
C