It might be a fine feature addition to either include or exclude certain file types - I just installed the module and it seems to be doing what it's supposed to with flying flags, but after just a few minutes I notice that I got 50 downloads for a couple of jpg files. I know I could just change the file paths not to go through Drupal, but I just ended up forking the download_count_file_download-function :P
I just added if(substr($filepath, -4) == '.mp3') for an ugly approach ;)
Great job and documentation!
Comments
Comment #1
tormu commentedactually $filename, not $filepath ;)
Comment #2
Chill35 commentedI see. It's something I overlooked and I really should have thought of this : I suppose that you are using a contrib module to put images in your nodes... am I correct ? If so, which module(s) are you using ? On my end, I am putting images in my nodes "by hand", I am not using the upload module to insert images in my nodes. Any file that was uploaded to a node is considered by download_count - which won't be such a good idea for people like you, and there will be a lot of people like you.
I'll figure out something! Thanks a million for bringing this up.
Actually documentation is lacking for this project. I still have to add a README.txt file and comment my code, so that it can be hacked easily for one thing ;)
That approach ain't ugly, if you're checking as early as "first line" in that function.
Comment #3
tormu commentedI'm using img_assist for images, and it seems to be adding /system/ to the paths..
For an ugly approach I ment that I just forked your code rather than doing it The Drupal Way by wondering more about it and making it an setting - this way it's easy to count jst one file type, but multiple ones would make it even dirtier.
Comment #4
Chill35 commentedI added an admin setting, jari. I got my inspiration if you will from the upload module settings page where you can list a bunch of extensions separated by a space...
Somehow there is glitch with my Drupal 5 version, but it works well in Drupal 4.7, and without a decrease in performance. I'll turn in my changes to CVS sometime today. Check again tomorrow for a built version. And thanks for bringing this up.
Most people I think use img_assist or some other image module with or without a WYSIWYG text editor to upload images due to how it's not done well in core to add inline images.
Comment #5
Chill35 commentedI changed both 4.7 and 5 versions today to include these changes. Thanks again.
Comment #6
Chill35 commented