News:

CPG Release 1.6.29
During HTML5 upload, keep pseudo blank code 200 messages from triggering error condition
added Russian language
correct failure to use theme menu icons in album manager
minor vulnerabilities mitigation

Main Menu

Changing The Filesize Info

Started by will, June 17, 2007, 10:34:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

will

Is there a way of changing the filesize info so it shows MB if the file is over 1,000 KB

Example: http://cdcoverhideout.com/gallery/displayimage.php?album=lastup&cat=0&pos=0 (You can view without registering)

Any help will be great, I've looked in the english lang file but couldn't see anything.

Thanks ;D

Sami

You should code it under functions.inc.php display_thumbnails function
instead of shifting 10 times to right

$lang_display_thumbnails['filesize'].($row['filesize'] >> 10).$lang_byte_units[1]."\n".


you should shifting 20 times or code you logic , BTW you should check file size before doing this , something like this would help you

if($row['filesize'] << 1000){
$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
                                $lang_display_thumbnails['filesize'].($row['filesize'] >> 10).$lang_byte_units[1]."\n".
                                $lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
                                $lang_display_thumbnails['date_added'].localised_date($row['ctime'], $category_date_fmt);

}else{
$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
                                $lang_display_thumbnails['filesize'].($row['filesize'] >> 20).$lang_byte_units[2]."\n".
                                $lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
                                $lang_display_thumbnails['date_added'].localised_date($row['ctime'], $category_date_fmt);
}
‍I don't answer to PM with support question
Please post your issue to related board

will

I replaced

$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
                                $lang_display_thumbnails['filesize'].($row['filesize'] >> 10).$lang_byte_units[1]."\n".
                                $lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
                                $lang_display_thumbnails['date_added'].localised_date($row['ctime'], $category_date_fmt);


With

$pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
                                $lang_display_thumbnails['filesize'].($row['filesize'] >> 20).$lang_byte_units[2]."\n".
                                $lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
                                $lang_display_thumbnails['date_added'].localised_date($row['ctime'], $category_date_fmt);


This still doesn't change anything, and if I add the second part of code under the first part of code I get an error ???

Any help would be great ;D

will

Ignore that last post, everything went ok changing the code but it still doesn't change anything ;D

Nibbler

Wrong place. The code to change is displayimage.php


    $info[$lang_picinfo['File Size']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . '&nbsp;' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . '&nbsp;' . $lang_byte_units[0]);


Try


function bsize($s) {
foreach (array('','K','M','G') as $i => $k) {
if ($s < 1024) break;
$s/=1024;
}
return sprintf("%5.1f %sB",$s,$k);
}

$info[$lang_picinfo['File Size']] = bsize($CURRENT_PIC_DATA['filesize']);

will

Thank you nibbler, worked a treat ;)