coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: will on March 08, 2007, 07:13:13 PM

Title: File Info
Post by: will on March 08, 2007, 07:13:13 PM
I currently had help from nibbler on this and was wondering why it has stopped at 2GB, it will not increase, here's the code I'm using

Quote$sql = "SELECT sum(hits), sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        $total_filesize = (int)$nbEnr[1];
        mysql_free_result($result);

        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[total_filesize]' => round($total_filesize/1024/1024/1024, 2)
                    ));

Would be great if anyone can help me with this ;D
Title: Re: File Info
Post by: Nibbler on March 08, 2007, 09:34:35 PM
Try like this:


$sql = "SELECT sum(hits), round(sum(total_filesize)/1024/1024/1024, 1) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
        $result = cpg_db_query($sql);
        $nbEnr = mysql_fetch_array($result);
        $hit_count = (int)$nbEnr[0];
        $total_filesize = $nbEnr[1];
        mysql_free_result($result);

        if (count($cat_data)) {
            $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count,
                    '[total_filesize]' => $total_filesize
                    ));


I think the number got too large to be an integer.
Title: Re: File Info
Post by: will on March 08, 2007, 09:41:44 PM
Thanks that got it to increase, but its only showing as 2GB because I took out 1 of the 1024:

Quote/1024/1024/1024

and made it:

Quote/1024/1024

and it was showing as 2250GB

but if I add it again it goes back to 2GB, hope you understand, is there a way of getting it to show as 2.2GB

Thanks
Title: Re: File Info
Post by: Nibbler on March 08, 2007, 09:43:55 PM
Try now.
Title: Re: File Info
Post by: will on March 08, 2007, 09:46:33 PM
Thanks Nibbler, spot on mate ;D