[TYPO3-dev] Byte size of image

Steffen Kamper info at sk-typo3.de
Fri Mar 27 21:45:52 CET 2009


Tapio Markula schrieb:
> Xavier Perseguers kirjoitti:
>> Hi,
>>
>>> Evaluating frontend plugin is there any Typo3 or generic PHP function 
>>> to get the byte size of a image?
>>
>> Euh... php's filesize()?
>>
> ok - but
> 
> if($imageDetails['bytesize']>1000000)
>              
> $imageDetails['bytesize']=floatval($imageDetails['bytesize']/1000000).' 
> Mb';
>             elseif  ($imageDetails['bytesize']>1000)               
>                 
> $imageDetails['bytesize']=floatval($imageDetails['bytesize']/1000).' Kb';
> 
> how to limit decimals - should get only one,
> not for example
> 5.378483 Mb
> 
> but
> 5.3 Mb

this is wrong anyway: 1KB = 1024B and not 1000B
2nd there are enough php functions like number_format

vg Steffen




More information about the TYPO3-dev mailing list