Forums / Setup & design / How to get the size of a remote file?

How to get the size of a remote file?

Author Message

Marco Zinn

Friday 10 December 2010 10:51:55 am

Hi there,

I'm looking for a way (template operator) to retrieve the size of a remote file. I have the full URL of the file in a text line attribute and I want to create a link in the template to the file. Works nice. Now, i want to display the (remote) file size next to the link.

How can this be done? I did not find a template operator for this yet. Although, there does not seem to exist a PHP function for this. I thought, i could use "filesize" for this (http://php.net/manual/de/function.filesize.php ) and use it throught PHPOperatorList , but this is only intended for local files.

Any idea?

Marco
http://www.hyperroad-design.com

Carlos Revillo

Friday 10 December 2010 11:24:52 am

Maybe you can have a look at some of the comments to filesize function and do a function working like that.

have a look at

http://www.php.net/manual/en/function.filesize.php#92462

Ivo Lukac

Monday 13 December 2010 12:56:11 am

"

Hi there,

I'm looking for a way (template operator) to retrieve the size of a remote file. I have the full URL of the file in a text line attribute and I want to create a link in the template to the file. Works nice. Now, i want to display the (remote) file size next to the link.

How can this be done? I did not find a template operator for this yet. Although, there does not seem to exist a PHP function for this. I thought, i could use "filesize" for this (http://php.net/manual/de/function.filesize.php ) and use it throught PHPOperatorList , but this is only intended for local files.

Any idea?

"

Try it with curl. E.g.. http://snipplr.com/view/29/get-remote-filesize/

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Marco Zinn

Tuesday 14 December 2010 1:47:55 pm

Thanks for your replies.

So, i read, that currently, there is no built-in or otherwise "easy-to-get" option for this. One would need to write a (simple) template operator for it, right?

Marco
http://www.hyperroad-design.com

Ivo Lukac

Wednesday 15 December 2010 12:31:33 am

"

Thanks for your replies.

So, i read, that currently, there is no built-in or otherwise "easy-to-get" option for this. One would need to write a (simple) template operator for it, right?

"

In short, yes :)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

eZ debug

Timing: Jan 18 2025 00:05:28
Script start
Timing: Jan 18 2025 00:05:28
Module start 'content'
Timing: Jan 18 2025 00:05:29
Module end 'content'
Timing: Jan 18 2025 00:05:29
Script end

Main resources:

Total runtime1.0602 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.8281180.8359
Module start 'content' 0.00590.9117 768.6641614.0313
Module end 'content' 0.91760.1425 1,382.6953337.3828
Script end 1.0601  1,720.0781 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.3646210.0002
Check MTime0.00140.1356210.0001
Mysql Total
Database connection0.00080.074110.0008
Mysqli_queries0.969891.47632050.0047
Looping result0.00200.19032030.0000
Template Total1.037397.820.5187
Template load0.00220.203420.0011
Template processing1.035297.638720.5176
Template load and register function0.00030.023910.0003
states
state_id_array0.00160.149810.0016
state_identifier_array0.00070.066420.0004
Override
Cache load0.00180.1721340.0001
Sytem overhead
Fetch class attribute can translate value0.00120.114540.0003
Fetch class attribute name0.00130.118070.0002
XML
Image XML parsing0.00130.125440.0003
class_abstraction
Instantiating content class attribute0.00000.002190.0000
General
dbfile0.01291.2165340.0004
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs