Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Add star rating to album's thumbnail view?  (Read 3370 times)

0 Members and 1 Guest are viewing this topic.

Colliope

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 126
Add star rating to album's thumbnail view?
« 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
Logged

Nibbler

  • Guest
Re: Add star rating to album's thumbnail view?
« Reply #1 on: June 14, 2007, 01:21:58 am »

include/functions.inc.php, search for

Code: [Select]
                // Set picture caption
                if ($set_caption) build_caption($rowset);

and change it to

Code: [Select]
                // Set picture caption
                if ($set_caption) build_caption($rowset, array('pic_rating'));

Also, change

Code: [Select]
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';
to

Code: [Select]
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name, votes, pic_rating';
To hide pics with no ratings, change

Code: [Select]
            $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

Code: [Select]
            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>';
« Last Edit: June 15, 2007, 03:19:43 pm by Nibbler »
Logged

Colliope

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 126
Re: Add star rating to album's thumbnail view?
« Reply #2 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
Logged

Colliope

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 126
Re: Add star rating to album's thumbnail view?
« Reply #3 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
Logged

Colliope

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 126
Re: Add star rating to album's thumbnail view?
« Reply #4 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
Logged

Nibbler

  • Guest
Re: Add star rating to album's thumbnail view?
« Reply #5 on: June 15, 2007, 03:20:04 pm »

See updated instructions.
Logged

Colliope

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 126
Re: Add star rating to album's thumbnail view?
« Reply #6 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
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 15 queries.