coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: Colliope on June 14, 2007, 01:14:52 AM

Title: Add star rating to album's thumbnail view?
Post by: Colliope on June 14, 2007, 01:14:52 AM
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
Title: Re: Add star rating to album's thumbnail view?
Post by: Nibbler on June 14, 2007, 01:21:58 AM
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>';
Title: Re: Add star rating to album's thumbnail view?
Post by: Colliope on June 15, 2007, 06:07:27 AM
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
Title: Re: Add star rating to album's thumbnail view?
Post by: Colliope on June 15, 2007, 06:18:05 AM
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
Title: Re: Add star rating to album's thumbnail view?
Post by: Colliope on June 15, 2007, 06:33:10 AM
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
Title: Re: Add star rating to album's thumbnail view?
Post by: Nibbler on June 15, 2007, 03:20:04 PM
See updated instructions.
Title: Re: Add star rating to album's thumbnail view?
Post by: Colliope on June 15, 2007, 05:16:10 PM
OK, I'll try it again. I need to change all three lines of code right, not just the latest one?

Thanks,
C