Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Variables for web images. Is this possible?

Variables for web images. Is this possible?
Thread Tools
badtz
Mac Elite
Join Date: May 2002
Location: Los Angeles, CA.
Status: Offline
Reply With Quote
Dec 10, 2003, 03:39 AM
 
Greetings

I was wondering if this was possible to do .....

to load up an html page with an image.

the html for the image would be something like ...

<img src="http://www.domain.com/example.gif?var=1234">


something along that line, adding a "variable" to the image so I can trace everytime that image is loaded up? [of course, with the variable changing every time that page loads up]


is something like this possible? I've personally never heard of this, but I've been told it IS possible.

????? Thanks!
     
ameat
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Dec 10, 2003, 08:44 AM
 
you can write a quick perl/php/asp script that accepts a variable which then tells the script to serve that image and log the viewing. you would then access it with:
Code:
<img src="/cgi-bin/imagescript.pl?image=003" />
     
bluedog
Mac Elite
Join Date: Aug 2000
Location: Minneapolis, MN
Status: Offline
Reply With Quote
Dec 10, 2003, 04:38 PM
 
Are you looking for an 'image counter' to count how many times it has been viewed? There are a few image gallery scripts written in PHP that will do this for you, but it give you more than that and may be tricky for you to set up.

See if your ISP allows PHP scripting, go to:
http://www.freshmeat.net/

Then do a search for 'gallery' and you should find what you are looking for.

Good luck!
     
badtz  (op)
Mac Elite
Join Date: May 2002
Location: Los Angeles, CA.
Status: Offline
Reply With Quote
Jan 12, 2004, 08:34 PM
 
Originally posted by ameat:
you can write a quick perl/php/asp script that accepts a variable which then tells the script to serve that image and log the viewing. you would then access it with:
Code:
<img src="/cgi-bin/imagescript.pl?image=003" />
Is the ASP script code easy to write? Example maybe?

Thanks for the help!
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 12, 2004, 09:02 PM
 
Originally posted by badtz:
Is the ASP script code easy to write? Example maybe?

Thanks for the help!
I couldn't help with asp, but to do it as php or a CGI is trivial. Let me know which one you want to do and I'll post an example (or someone else will).
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
larkost
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Jan 13, 2004, 10:00 AM
 
If what you are trying to do is to track the number of times something has been loaded, why not simply count the number of times that image appears in your server hit log? If you are using apache and have command line access this is trivial. If this is what you want just enter this on the command line:

Code:
cat /path/to/server-log | grep "image-name"
On my system /path/to/server-log is /var/log/httpd/access_log. If you only want a count of the number of times (and don't want the rest of the information), then put a -c in front of the image-name.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:28 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,