
內容簡介
「Get Filesize Shortcode」是一個簡單的短碼外掛,可以以可讀的格式以最大可讀單位顯示文件(例如 PDF、JPG、PNG 等)的檔案大小。
使用方法
在文章中的任何地方輸入[filesize]http://yoursite.com/path/to/file.pdf[/filesize]。
你也可以使用 url 屬性代替,輸入[filesize url='http://yoursite.com/path/to/file.pdf']
同時,你也可以把<?php echo do_shortcode('[filesize]http://yoursite.com/path/to/file.pdf[/filesize]'); ?> 放到你的樣本中。
注意事項
檔案必須存放在你的伺服器上
對於超過 2MB 的文件,可能會因 PHP 的檔案大小規範而返回不同的數字。
外掛標籤
開發者團隊
原文外掛簡介
“Get Filesize Shortcode” is a simple shortcode to get filesize of a file( eg. PDF, JPG, PNG … ) with a human readable format, using the largest unit the bytes will fit into.
Now added Get filesize block to display file link with file size.
Usage
Put [filesize]http://yoursite.com/path/to/file.pdf[/filesize] anywhere in a post.
Or you can use url attr instead. [filesize url='http://yoursite.com/path/to/file.pdf']
Also you can place in your templates.
As to “Get filesize” block, search ‘get filesize’ in Text block category and insert it.
Set file title and file url, and it generates a text link to the file with file size afterwards.
You can toggle Preview/Edit by clicking Preview/Edit button in toolbar of the block.
Note
File must be in your server
With files larger than 2MB, it might return different number due to the spec of filesize function of PHP.
