Display less last comments Display less last comments
 

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]

Main Menu

Display less last comments

Started by Flipper01, September 19, 2005, 09:25:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Flipper01

I have more than 6000 pictures in my photoalbum and if I want to see the last comments I get 1500 comments (example) wich take a long time to download.
Is it possible to change the number of comments displayed? I tried to edit the functions.inc.php but it didn't work out the way I wanted. Hope someone here can help me out.

Nibbler

displayimage.php:

$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC");

You can add in a limit there:

$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC LIMIT xxx");

Flipper01

Hmm I guess you didn't understand my problem.. ;)

The problem wasn't about the comments under my pictures but about the comments that appear when I hit the 'last comments' button.
It now displays 250 rows of thumbnails and that takes a long time to load. I hope it is possible to change the 250 rows in 25 or so.

My gallery: http://w3.frw.rug.nl/ibn/7.fotoboek/
My last comments: http://w3.frw.rug.nl/ibn/7.fotoboek/thumbnails.php?album=lastcom

Nibbler

It will display as many rows as you have set to be displayed in config.

Flipper01

Quote from: Nibbler on September 19, 2005, 11:05:37 PM
It will display as many rows as you have set to be displayed in config.
I was afraid of that, but isn't it possible to change that number of rows when displaying the last comments?

I tried to edit line 537 of functions.inc.php:
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $keyword $TMP_SET ORDER by msg_id DESC $limit");
to:
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $keyword $TMP_SET ORDER by msg_id DESC LIMIT 0,50");

This only displays the last 50 comments, but with that come some problems:
- if you click on one of the pictures to read the full comment you end up with the picture with the last comment
- if you select one of the other pages at the bottom of the last comm page you still get the last 50 comments

I hope it is possible to change this without changing the number of rows displayed in albums

Stramm

I don't understand your problems... if you've set 250 rows in config then it's slow for all pages you let coppermine display... browsing the last uploads eg will bring up (I assume) 250x4 thumbs, same for the last comments. And the lil bit more text is neglectable


Flipper01

Quote from: Stramm on September 20, 2005, 10:16:15 AM
I don't understand your problems... if you've set 250 rows in config then it's slow for all pages you let coppermine display... browsing the last uploads eg will bring up (I assume) 250x4 thumbs, same for the last comments. And the lil bit more text is neglectable

Therefore I don't display the last uploads. The 250 rows are set for gallery's with lots of pictures (so that people can see all pictures at once), but the average album contains 50 pictures.
So there is a big difference between browsing a normal gallery or watching all the last comments.

Joachim Müller

having 250 rows just is a silly setting. If you insist to keep it, you'll have to live with the other drawbacks.

Stramm

still.... I let cpg display 8 rows x 2 columns => 16 thumbs... and that loads fast. If visitors want to see more they click one of the tabs, or next/ prev for more thumbnails. That's far less annoying than to have to wait several minutes (there are still guys without ADSL)... and why push 1mb data in thumbnails if the guy just wants to see a single pic? It's like driving a tank for shopping
However... if you want to change that 'behaviour' then have someone modify your coppermine. It's not that hard to do

Flipper01

Quote from: GauGau on September 20, 2005, 10:35:48 AM
having 250 rows just is a silly setting. If you insist to keep it, you'll have to live with the other drawbacks.
Well I'm quite stubborn about that.  ;)
I'd like to display all my thumbs on one page, because the users of my gallery are quite clumsy with computers/internet and therefore I want to make it as easy as possible (I'm afraid they don't click further to the other pages).

I had hoped there was an easy way to change the number of rows displayed at the last comments, but I guess I'll have to leave it this way.

Abbas Ali

No you don't have to leave it :)

First revert the query and remove that LIMIT from it (i mean make it as it was originally).

Edit thumbnails.php file. (Take a backup before editing)

Find


display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);


and REPLACE it with


if ($album == "lastcom") {
  $thumbrows = 5;  // Change this value to whatever you want.
} else {
  $thumbrows = $CONFIG['thumbrows'];
}
display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $thumbrows, true);


Above code will dislplay only 5 rows. You can change it to whatever you like.

This will apply only to Last Comments and all other meta albums like Last Uploads etc.. will still have 250 rows.

I hope this is what you wanted.
Chief Geek at Ranium Systems

Flipper01

Awesome!  ;D

Thanks a lot Abbas Ali, this was just what I was looking for!