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
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 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
Ignore that last post, everything went ok changing the code but it still doesn't change anything ;D
Wrong place. The code to change is displayimage.php
$info[$lang_picinfo['File Size']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . ' ' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . ' ' . $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']);
Thank you nibbler, worked a treat ;)