Count download of files

Author Message

Kjell Inge Sandvik

Friday 26 August 2005 7:44:47 am

Hello

I am aware that the ezbinaryfile has attribute that is called <i>download_count</i> for holding the number of times a binary files is downloaded.

But; I have some articles with pictures in it. I want to keep a counter over how many times each of those pictures are downloaded. Is this possible to do?

Sandvik Web & Data

Marko Žmak

Friday 26 August 2005 12:37:51 pm

As far as I know, there's no way to do it using a standard eZ installation... You could look for some extension in contributions. I think that there's an extension that can parse the apache log file to count page hits. And since pictures in eZ are stored in folders, maybe this could be the sollution.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Inge Sandvik

Sunday 28 August 2005 4:55:31 am

Thank you Marko for your answer.

Are there anyone else that may have a solution/done this before?

Sandvik Web & Data

Marko Žmak

Sunday 28 August 2005 7:08:56 am

Hm... Now that i think of this...

There's an extension called "ezstats", made by Konrad Mazurkiewicz and I'm working on it too.

This extension defines a new eZ operator that when called with a node id counts that node. And then you can see how many times a node was accesed.

This is primarily used as page hit's counter, but if the pictures you want to count are actually nodes in eZ, I think that ezstats can be used for your needs.

Check out the extension here:

http://ez.no/community/contribs/template_plugins/ezstats

and contact me if you need help.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Inge Sandvik

Tuesday 30 August 2005 1:37:19 am

Thank you Marko - I will check out that extension.

What I am developing is a library system containing of pictures, documents and other media files. All files are presented with corresponding info about them; i.e. title, date, maker etc. in a thumbnail gallery. When the user clicks on a thumbnail, the system will show a new page where the user can download the media. Here's the point where the download counter will be.

Sandvik Web & Data

Marko Žmak

Tuesday 30 August 2005 2:00:53 am

So if I understood you well, you want to count how many times a user opened the download page for an item. If so, that can be done with ezstats.

You'll have to call the ezstats operator that counts nodes in the template used for the download page.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Inge Sandvik

Tuesday 30 August 2005 3:24:15 am

Thank you again Marko.

That's almost what I'm trying to do, but I want the counter to increase when the file is downloaded, not when only viewed. Is it possible to connect the ezstats extension to that specified action <i>download</i>?

Sandvik Web & Data

Kjell Inge Sandvik

Wednesday 31 August 2005 1:02:44 am

I have now got a counter when downloading media of type FILE (by using download_counter), but what about IMAGES?

Sandvik Web & Data

Kjell Inge Sandvik

Thursday 01 September 2005 11:00:21 pm

Anyone?

Also; the problem is that I have to count the number of times an IMAGE is downloaded (not viewed) the same way as for the FILE attribute of an object.

I surly could have defined the imagedata as FILE aswell, but then I loose the availibility to scale them using attribute_view_gui and image_class.

Sandvik Web & Data

Marko Žmak

Friday 02 September 2005 1:40:25 am

I've been busy theese days so I didn't answer...

If you can override some template for your download action then, yes you CAN count the downloads of the pictures. How do you make your pictures available for download? Please, be detailed.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Inge Sandvik

Friday 02 September 2005 2:13:22 am

Thank you again Marko!

All I have done to make them downloadable is:

{def $attribute=$node.object.data_map.bilde}
<a href={concat( 'content/download/',
$attribute.contentobject_id,
'/', $attribute.id, '/file/',
$attribute.content.original_filename|urlencode )|ezurl}>
     Download
</a>
{undef}

Sandvik Web & Data

Marko Žmak

Saturday 03 September 2005 7:29:18 am

You should check if you can override some eZ template for:

content/download

I'm too busy to check it out, so you should do it. Try browsing the eZ docs, or asking on forum.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kjell Inge Sandvik

Tuesday 06 September 2005 11:15:26 pm

Thank you Marko, but I havn't got a clue how to do this. Anybody else?

Sandvik Web & Data

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:38:51
Script start
Timing: Jan 18 2025 19:38:51
Module start 'layout'
Timing: Jan 18 2025 19:38:51
Module start 'content'
Timing: Jan 18 2025 19:38:52
Module end 'content'
Timing: Jan 18 2025 19:38:52
Script end

Main resources:

Total runtime0.8908 sec
Peak memory usage4,096.0000 KB
Database Queries87

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 589.0234152.6250
Module start 'layout' 0.00700.0036 741.648439.4453
Module start 'content' 0.01060.8786 781.0938658.6406
Module end 'content' 0.88920.0016 1,439.734428.1719
Script end 0.8908  1,467.9063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4033160.0002
Check MTime0.00130.1515160.0001
Mysql Total
Database connection0.00150.166810.0015
Mysqli_queries0.797989.5685870.0092
Looping result0.00080.0921850.0000
Template Total0.852395.720.4261
Template load0.00200.224420.0010
Template processing0.850395.449020.4251
Template load and register function0.00010.008910.0001
states
state_id_array0.00160.179710.0016
state_identifier_array0.00190.208620.0009
Override
Cache load0.00180.2032600.0000
Sytem overhead
Fetch class attribute can translate value0.00050.051320.0002
Fetch class attribute name0.00110.1241150.0001
XML
Image XML parsing0.00130.147220.0007
class_abstraction
Instantiating content class attribute0.00010.0064260.0000
General
dbfile0.00130.1497240.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
13content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
13content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs