CyberiaPC.com Community Forums Main Page
RSS Feeds: Late(st) News | Zenith Picture Gallery | Most Recent Community Topics | Tips, Tricks and Other Useful Stuff

Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> View counter also to count on small and medium size
Hanno
post Feb 22 2006, 08:09 PM
Post #1


New Member
*

Group: Members
Posts: 17
Joined: 10-June 05
Member No.: 2,693

Netherlands




Currently the view counter is only increased when viewing the orginal size.

I would like the counter to count for small / medium and large size.

Could it be possible to add an option in the admin CP so you can choose what should be counted?

Thanks,

Hanno
Go to the top of the page
 
+Quote Post
usr.c
post Sep 13 2007, 08:01 PM
Post #2


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




Sorry for the late reply, not sure how I missed this original.gif

In v0.9.4, look in pic_details.php for

CODE
if(!isset($_SESSION['pic_size'])) {
        if($config['default_preview_pic_size'] == 0) echo "<b>{$lang['small']}</b> | ";   else   echo "<a href='pic_details.php?pid=$pid&amp;size=0'>{$lang['small']}</a> | ";
        if($config['default_preview_pic_size'] == 1) echo "<b>{$lang['medium']}</b> | ";   else   echo "<a href='pic_details.php?pid=$pid&amp;size=1'>{$lang['medium']}</a> | ";
        if($config['default_preview_pic_size'] == 2) {
            echo "<b>{$lang['original']}</b>";
            
            //increment views counter for full-size pics
            $pid = $_GET['pid'];
            if(is_numeric($_GET['pid'])) {
                $row_counter = mysql_fetch_array(mysql_query("SELECT counter, title, pic_width, pic_height FROM {$config['table_prefix']}pictures WHERE pid='$pid'"));
                $counter = $row_counter['counter']+1;
                $result_counter = mysql_query("UPDATE {$config['table_prefix']}pictures SET counter=$counter WHERE pid='$pid'");
            }
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=2'>{$lang['original']}</a>";
    }
    else {
        if($_SESSION['pic_size'] == 0) echo "<b>{$lang['small']}</b> | ";   else   echo "<a href='pic_details.php?pid=$pid&amp;size=0'>{$lang['small']}</a> | ";
        if($_SESSION['pic_size'] == 1) echo "<b>{$lang['medium']}</b> | ";   else   echo "<a href='pic_details.php?pid=$pid&amp;size=1'>{$lang['medium']}</a> | ";
        if($_SESSION['pic_size'] == 2) {
            echo "<b>{$lang['original']}</b>";
            
            //increment views counter for full-size pics
            $pid = $_GET['pid'];
            if(is_numeric($_GET['pid'])) {
                $row_counter = mysql_fetch_array(mysql_query("SELECT counter, title, pic_width, pic_height FROM {$config['table_prefix']}pictures WHERE pid='$pid'"));
            $counter = $row_counter['counter']+1;
                $result_counter = mysql_query("UPDATE {$config['table_prefix']}pictures SET counter=$counter WHERE pid='$pid'");
            }
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=2'>{$lang['original']}</a>
        ";
    }

and replace it with

CODE
//modified for user request on September 13, 2007
    if(!isset($_SESSION['pic_size'])) {
        if($config['default_preview_pic_size'] == 0) {
            echo "<b>{$lang['small']}</b> | ";
            $should_i_up_the_counter = 0;
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=0'>{$lang['small']}</a> | ";
        
        if($config['default_preview_pic_size'] == 1) {
            echo "<b>{$lang['medium']}</b> | ";
            $should_i_up_the_counter = 1;  
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=1'>{$lang['medium']}</a> | ";
        
        if($config['default_preview_pic_size'] == 2) {
            echo "<b>{$lang['original']}</b>";
            $should_i_up_the_counter = 1;
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=2'>{$lang['original']}</a>";
    }
    else {
        if($_SESSION['pic_size'] == 0) {
            echo "<b>{$lang['small']}</b> | ";
            $should_i_up_the_counter = 0;
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=0'>{$lang['small']}</a> | ";
        
        if($_SESSION['pic_size'] == 1) {
            echo "<b>{$lang['medium']}</b> | ";
            $should_i_up_the_counter = 1; //up the counter for medium
        }
        else   echo "<a href='pic_details.php?pid=$pid&amp;size=1'>{$lang['medium']}</a> | ";
        
        if($_SESSION['pic_size'] == 2) {
            echo "<b>{$lang['original']}</b>";
            $should_i_up_the_counter = 1; //up the counter for full-size
        }
        else echo "<a href='pic_details.php?pid=$pid&amp;size=2'>{$lang['original']}</a>";
    }
    
    if(isset($should_i_up_the_counter) && $should_i_up_the_counter == 1) {
        //increment views counter for full-size pics
        $pid = $_GET['pid'];
        if(is_numeric($_GET['pid'])) {
            $row_counter = mysql_fetch_array(mysql_query("SELECT counter, title, pic_width, pic_height FROM {$config['table_prefix']}pictures WHERE pid='$pid'"));
            $counter = $row_counter['counter']+1;
            $result_counter = mysql_query("UPDATE {$config['table_prefix']}pictures SET counter=$counter WHERE pid='$pid'");
        }
    }


That should do the trick. The modified file is attached.
Attached File(s)
Attached File  pic_details.php ( 19.59K ) Number of downloads: 61
 


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
ashtar5
post Dec 11 2007, 07:18 PM
Post #3


New Member
*

Group: Members
Posts: 10
Joined: 9-December 07
Member No.: 9,421

Canada




Thanks dude you rock!

- Dan
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd May 2013 - 09:25 PM