[TYPO3-dev] Byte size of image
Xavier Perseguers
typo3 at perseguers.ch
Fri Mar 27 21:47:52 CET 2009
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
OK. Thus your question is not how to get the size in byte of an image
but how to human-format it?
I guess you'll be interested into
$size = ....;
t3lib_div::formatSize($size, $GLOBALS['LANG']->getLL('byteSizeUnits',
true));
HTH
--
Xavier Perseguers
http://xavier.perseguers.ch/en
One contribution a day keeps the fork away
More information about the TYPO3-dev
mailing list