Easy way to show filesize of image in panel?

I’m creating a field blueprint that can be inserted into page blueprints to save time and consistency.

I see the file.filesize option to show a filesize in the “info:” line of a files field.
But it’s outputting the total number of bytes as 190443 instead of 185Kb, or so.


Is there an easy way to change this for clients to easily understand this number in the panel?

Yes, of course:

Doesn’t work for me:
{{ file.filesize.niceSize }}

You dont’s need to convert the file size twice, {{ file.niceSize }} will work.

1 Like

Thank you, GB!

1 Like

Gladly :+1:
With this code, you can make your cardlet even prettier:
info: "{{ file.dimensions }} ({{ file.niceSize }}) <br>{{ file.modified('M-d-Y') }}

1 Like