Jump to content

Recommended Posts

Posted

I have a feeling this isn't possible without having some type of root access, but here goes.

 

Does anyone know of any script or program that can track number of file views (such as views from hotlinking images) or track the amount of bandwidth said image is consuming based on the number of views? Is it possible to even track these types of stats without having access to some backend process?

 

The reason I was asking is I have a small site that hosts images for people to use as a signature in forums. Was wondering if its possible to track image usage. Thanks.

Posted
Have you looked at your AwStats in your cPanel?

 

 

sorry, I should have mentioned that I'd seen awstats tracking this type of information, but was curious as to whether or not this would be information I could track in a database of my own, like every time the file is viewed remotely (or locally) it could insert a flag into a database with image information tied to a user account. Awstats does that type of thing (showing bandwidth per file/image, etc....) but I wasn't sure if I could access the same data that Awstats does without having a higher level access.

 

Hope that clears up my question :rolleyes:

Posted

Sorry, I wasn't sure what you were asking. You could try www.hotscripts.com and see if you can find a script that tracks downloads. I think that would be what you are looking for.

Posted
I think I may have found something that I can use. Thanks for the suggestion.

Hey, don't hold out! :D If you get it working let the rest of us know how you did it.

Posted

Will do. :D Its not so much a script that I discovered but a process for doing it (looking at source code, but I don't use their code, I like to use a way of doing something in my own way - my own code rather). You would do http://www.something.com/your_image.php?id=xxxx and along mod_rewrite somehow in there it somehow servers up the image, but i'm still working on that part.

 

But linking to your image that way, you can update a database record each time the file is accesed (using code inside the php page), even if the image is included in a page somewhere like a forum. If you know the file size, you can get a rough estimate of how much bandwidth the file has used by multiplying the number of times accessed by size as well as the number of times each image has been viewed.

 

I'll have to remember this post and update you on how it worked if I can ever get it working on the revised site that i'm working on.

Posted

I hate double posting, but heres a quick example of what I've done with this since a few of you were interested in how it would work.....

 

Here is a few lines of code i put in a test.php file to opening the image and tossing it into a buffer.....

 

><?
$img = $_GET['img'];
$img = preg_replace('/[^a-z0-9A-Z.]/', '_', $img);
Header("Content-type: image/x-png");
$fn=fopen("/home/your_account/public_html/imagehost/$img","r");
fpassthru($fn);
?>

 

Here is a quick demonstration that I threw up as a test....

http://www.reversedreality.com/imagehost/TCH_forums.php

 

inside the actual test php is where you can track views, etc... since each time that file is viewed or looked at, it has to hit that page where you can do various neat and fun stuff.

 

Hope this helps out anybody who has similar ideas for a image hosting site.

Posted

That's great. Thanks Shannon! And now it's memorialized for all who follow and search the forums. :angry:

 

(Memorialized - a term a lawyer friend of mine uses to mean CYA.)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...