Forums / Setup & design / Count download of files

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