What I want to be able to do is give people a small amount of code to add to their website, and from that a new image will be displayed daily (simply retrieving the location from a database or something that I add everyday).
Is javascript the thing to use to accomplish this?
@r_soleauthorDec 21.2007 — #Alright I decided on a way to do this, though I think it may lead to problems..
I just made a .js file and made it write what I wanted. Eg: [CODE]document.write("<img alt='daily image' src='http://www.WEBSITE/images/image.jpg'>[/CODE]
The way this .js file gets updated is - I put a line of code in the upload script, that I use to upload my images everyday, which replaces the contents of the .js file with the same thing but the 'image.jpg' part would be altered (eg 'image2.jpg').
I don't know, it just feels like a bad way to do it. Like there could be problems. I've seen many people instead of giving out a .js file, they give out a .cgi file. Is this possibly easier (as in it can update itself) ?
@Declan1991Dec 21.2007 — #What people do is they use a server side language that actually returns an image, not just a link to an image. For example, they link to http://www.WEBSITE.com/images/image.php and then in PHP use:
header("content-type","image/jpeg"); etc. but that is a PHP or any other server side issue.
@r_soleauthorDec 21.2007 — #The only bad thing about doing it the PHP way is that I don't have as much control over what the people are adding to their site.
For example, by using the javascript file I can make sure that the image that they get is also a link back to my site. I can also make sure that there is a border around the image and other things like that.
So there's not someway that they can add a .js or a .cgi file that somehow runs a server-side script on my site, that will return the image? Or some other way?
It doesn't really bother me, I'd use the php way if I needed to. Just curious now.