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: Album thumbnails appearing pixelated  (Read 5310 times)

0 Members and 1 Guest are viewing this topic.

alcorjr

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Album thumbnails appearing pixelated
« on: February 04, 2016, 01:33:46 am »

Hello guys, first of all I want to congratulate the developers for this excellent tool, (Cpg).

I do have a question, which I have observed in my latest install; the album thumbnails in the album gallery appear pixelated. I have tried the resize admin tool and it doesn't fix it. I think it might be , because I have set the albums (inside) thumbs at 220 px the largest, while the album thumbnail proper I have at 309 px.

 Could this be the reason? It's like if the system just uses the smaller thumbnail to display in the album gallery page. Of course, as it gets enlarged, it gets pixelated.

Is there any way around this?

Thanks
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Album thumbnails appearing pixelated
« Reply #1 on: February 04, 2016, 11:25:42 am »

Coppermine doesn't create separate "album thumbnails", but uses the regular thumbnails which are displayed at thumbnails.php. To fix your issue while keeping your settings, we need to modify the code to use the intermediate-sized pictures (if available) or the full-sized pictures as image file for the album thumbnails.
Logged

alcorjr

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Album thumbnails appearing pixelated
« Reply #2 on: February 06, 2016, 01:10:41 am »

Yes Andre, that's what I thought. Could you please tell me whay line of code I should modify? Thanks
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Album thumbnails appearing pixelated
« Reply #3 on: February 08, 2016, 11:56:27 am »

Open index.php, find
Code: [Select]
$pic_url = get_pic_url($picture, 'thumb');and replace with
Code: [Select]
$pic_url = get_pic_url($picture, 'normal');in functions list_albums and list_cat_albums

Note: there are two other occurrences of that line in index.php, so make sure
Code: [Select]
mysql_free_result($result);is not above the other line. Instead, it has to be a right curly bracket (once in combination with a blank line).
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Album thumbnails appearing pixelated
« Reply #4 on: February 08, 2016, 12:05:32 pm »

Note to myself: maybe a good idea to add a check if the album thumbnail if set larger than the picture thumbnail and/or intermediate-sized setting and then use the intermediate-sized or full-sized picture as album thumbnail instead.
Logged

alcorjr

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Album thumbnails appearing pixelated
« Reply #5 on: February 09, 2016, 04:09:29 pm »

Hello Andre,
Thanks for your help. I need some clarification, though. I have found four instances of the line of code you mention. Do I have to replace it in all of them?

1)
 if ($cat['details']['thumb'] > 0) {
            $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE pid = {$cat['details']['thumb']} $FORBIDDEN_SET";
            $result = cpg_db_query($sql);
            if (mysql_num_rows($result)) {
                $picture = mysql_fetch_assoc($result);
                mysql_free_result($result);
                $pic_url = get_pic_url($picture, 'thumb');

2)
 if (mysql_num_rows($result)) {
                $picture = mysql_fetch_assoc($result);
                mysql_free_result($result);
                $pic_url = get_pic_url($picture, 'thumb');

3)

        $keyword = ($alb_thumb['keyword'] ? "OR (keywords like '%".addslashes($alb_thumb['keyword'])."%' $forbidden_set_string )" : '');
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
            if ($count > 0 || !empty($alb_stats[$alb_idx]['link_pic_count'])) {
                if (!empty($alb_thumb['filename'])) {
                    $picture = &$alb_thumb;
                } elseif ($alb_thumb['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} "
                        . "WHERE ((aid = '{$alb_thumb['aid']}' $forbidden_set_string) $keyword) $approved "
                        . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                } else {
                    $picture = $last_pid_data[$alb_stat['last_pid']];
                }

                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }

4)

  $keyword = ($album['keyword'] ? "OR (keywords like '%".addslashes($album['keyword'])."%' $forbidden_set_string)" : '');
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) { //test for visibility
            if ($album['pic_count'] > 0  || !empty($album['link_pic_count'])) {
                if (!empty($last_pid_data[$album['thumb']]['filename'])) {
                    $picture = $last_pid_data[$album['thumb']];
                } elseif ($album['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} WHERE ((aid = '$aid' $forbidden_set_string) $keyword) $approved "
                        . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                } else {
                    $picture = $last_pid_data[$album['last_pid']];
                }
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }




Also, I notice that

mysql_free_result($result);


is above

$pic_url = get_pic_url($picture, 'thumb');


in all cases.

What do you mean by your last instruction?



Thanks a lot
Logged

alcorjr

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Album thumbnails appearing pixelated
« Reply #6 on: February 09, 2016, 04:11:53 pm »

Sorry, this is the 3rd instance:


  $keyword = ($alb_thumb['keyword'] ? "OR (keywords like '%".addslashes($alb_thumb['keyword'])."%' $forbidden_set_string )" : '');
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
            if ($count > 0 || !empty($alb_stats[$alb_idx]['link_pic_count'])) {
                if (!empty($alb_thumb['filename'])) {
                    $picture = &$alb_thumb;
                } elseif ($alb_thumb['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight "
                        . "FROM {$CONFIG['TABLE_PICTURES']} "
                        . "WHERE ((aid = '{$alb_thumb['aid']}' $forbidden_set_string) $keyword) $approved "
                        . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = mysql_fetch_assoc($result);
                    mysql_free_result($result);
                } else {
                    $picture = $last_pid_data[$alb_stat['last_pid']];
                }

                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Album thumbnails appearing pixelated
« Reply #7 on: February 09, 2016, 04:28:11 pm »

You have to replace 3) and 4)

As you can see, there's no
Code: [Select]
mysql_free_result($result);(directly) above that line, but a closing curly bracket. Alternatively just have a look at the functions those lines reside in.
Logged

alcorjr

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Album thumbnails appearing pixelated
« Reply #8 on: February 09, 2016, 04:38:06 pm »

It worked perfectly. Thanks a bunch!
Logged
Pages: [1]   Go Up
 

Page created in 0.038 seconds with 20 queries.