coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: irene on August 21, 2012, 07:31:06 PM

Title: Random Views Below Image?
Post by: irene on August 21, 2012, 07:31:06 PM
Hi,

I need random views below images in my gallery.
How do I do this?

For example each pic will show a number from 100 to 5000

I had it before on an older version and would like it again.

Thanks in advance.
Title: Re: Random Views Below Image?
Post by: Jeff Bailey on August 21, 2012, 10:44:09 PM
Can you give a little more detail as to what you want to accomplish?

Do you just want any random number under thumbnails? or the view count of the image?

If you had it before do you have a copy of the code you can post here?
Title: Re: Random Views Below Image?
Post by: irene on August 22, 2012, 02:15:14 PM
Yes,, here: http://forum.coppermine-gallery.net/index.php?topic=51863.07
Title: Re: Random Views Below Image?
Post by: Jeff Bailey on August 22, 2012, 07:33:31 PM
This does not update the database. So it does not show in the file information section. It also does not update the album views. I don't have the time to search though all the files and find the correct places to up date but here is a solution that shows a random number of views under the thumbnails.

Find in include/functions.inc.php

            $views = ($mode == 'albums') ? $row['alb_hits'] : $row['hits'];

and replace with

            //$views = ($mode == 'albums') ? $row['alb_hits'] : $row['hits'];
            $views = mt_rand(300,1000);


It should be located in the function build_caption()
Title: Re: Random Views Below Image?
Post by: irene on August 23, 2012, 01:22:52 PM
Thanks a million. That's all I wanted!