cwdjrxyz said:
Perhaps someone else knows of a script solution,
It depends on what you call a "script solution". There is no solution for
this with only client-side script in an unrestricted environment.
but this seems to be something best done on the server. There are several
server side programs that keep very detailed records of all of the hits to
your site, including page counts for all types of pages, including images
and music. [Webalizer]
A server-side application evaluating the server log files cannot distinguish
between image display, which requires download of image data first, or
image file download -- no URL modifications given, the request is exactly
the same. It also cannot know when data already downloaded is stored as a
file from a local buffer or a cache, which was the OP's requirement ("saved
to load to computers by visitors") -- that is something that needs to be
counted client-side.
The only way to count image _file_ downloads really is to provide for an
area where access to the image data requires a kind of login (may it be
automatically) on the Web site, and either serve the resource as inline
attachment only there (does not work in IE4 IIRC) or serve it with an
unrecognized media type, or use another client-side application that
registers a handler for the media type.
Compare Webshots.com who allow you to download up to 5 photos of lower
quality (800x600 instead of 16:9 or 1600x1200) a day with a free account
as application/x-webshots (suffix .wbz), but you need either the Webshots
application (Windows PC or Mac only) installed (which does the login
automatically before download) or you need to login on the Web site
yourself before this works, and for this you need to sign up before.
They use J(ava)Script generated server-side (pretty-printed here as best
as possible; a script that I would not recommend as is, though) to trigger
the respective CGI script, e.g.
function downloadPhoto(resolution)
{
document.cookie = "PopupReferer=" + escape(document.location.href)
+ "; path=/; domain=.webshots.com";
var args="&done=" + document.location.href
+ "&nextDisplayID=/tr/hr-sh/38583&tagExt=TopRated/HighestRated";
var url;
if (resolution == 'high')
{
url =
"
http://www.webshots.com/scripts/PhotoDownload.fcgi?res=high&targetmode=&photos=39285";
}
else if (resolution == 'wide')
{
url =
"
http://www.webshots.com/scripts/PhotoDownload.fcgi?res=wide&targetmode=&photos=39285";
}
else
{
url =
"
http://www.webshots.com/scripts/PhotoDownload.fcgi?res=low&targetmode=&photos=39285";
}
url += args;
var version=0;
if (document.VersionDetector)
{
if (document.VersionDetector.GetWSVersion)
{
version = document.VersionDetector.GetWSVersion();
if (version > 0)
{
url += '&swver=' + version;
}
}
}
var hasClient = (version > 0)
|| (document.cookie.indexOf("redirect=") >= 0);
if (!hasClient
&& (navigator.appName.indexOf("Microsoft Internet Explorer") >= 0))
{
url += '&action=noClientForDownload';
}
document.location.href = url;
}
which retains download count for the user ID in a database, I presume
(rest assured that modifying the cookie does not allow you to cheat
).
HTH
PointedEars