Wait, I first want to see what you are actually talking about!
Take a look at my
deviantart page and scroll down to
Webcam. Now, if you refresh the page some couple of times (hit F5), you'll see this image changes. So, this means you actually see a random picture of my picture database each time you visit my DeviantArt!
What do you need?
- A webserver that supports PHP. If you google a bit, I am sure you can find some free PHP webservers. To give you a start, I'll provide this url. I for myself have my own webserver, so I can't help you out much looking for a good free PHP host. However, if you have some money left, I can maybe convince you to rent your own web space. It's not so difficult to find webservers that cost you around 50 euro a year.
- An FTP client, to connect to your webserver. I really like FileZilla, because it has many features and is completely free!
What next?
- Upload some pictures to your webserver. Lets assume you have 10 pictures you want to show at random. Create a directory Profile (or name it different) on your FTP server. Upload your images (only JPG's!) into this directory and rename them as follow:
image01.jpg, image02.jpg, ... , image10.jpg
As an example, you can find my images here: avatar01 - avatar02 - avatar03
It is very important that you rename them this way, or our actual random image will not work.
- Open notepad and paste this code.
Now, the only important line in this code to you is the following one:
$bgNum = rand(1, 10);
If you add extra images into your Profile directory, (for example 5), you need to change the value 10 of this line into the new number of images (15 in this case). It should be clear now why it is so important to name your images with a sequential number.
- Save the previous code as avatar.png. Make sure you swith the Type to All Files in Notepad, or your image will be saved as avatar.png.txt instead of avatar.png!
Upload this file to the same directory as your images: Profile.
- The last thing we have to do before our random image will work, is write a .htaccess file. Open Notepad one more time and enter this code:
AddType application/x-httpd-php png
Save this file now as .htaccess . Again, mind you don't actually save it as a TXT file! Upload this file also in the same directory as your images are. Once this file is uploaded, it will become hidden and you will not be aware you actually uploaded it.
- We can see our result if we surf to our image avatar.png: at each page refresh we see a different image!
Here is my result!
- Enter the URL of this PNG image file now into your Webcam Url. To do so, click Edit Profile and goto User Page Display. There, you will find an attribute at the fifth row in the left panel which allows to specify a webcam url.
Save, and go back to your main page. If you scroll down, you will see your very own random DA webcam shot!
Feel free to comment or to ask any questions!
First of all, you need to enable the webcam feature on your DA account.
Devious Comments
--
In a critisism day? Take a look at my deviantART
"swishing swoom, outrageous orifice"
--
"Where we goin? Crazy, for some of us it's a shorter trip than for others." ~DamagedButRepairing~
Check out my
Previous PageNext Page