Post Reply 
Avatar change on refresh? [For Sale - .0030 EP]
Author Message
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #1
Avatar change on refresh? [For Sale - .0030 EP]
How do you do it?!

Generic sig goes here.
(This post was last modified: 24/01/2009 05:34 PM by -PHENOMENON-.)
24/01/2009 04:20 PM
Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #2
RE: Avatar change on refresh?
a php script used instead of image
The php script chooses from an array of images.

[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
(This post was last modified: 24/01/2009 04:21 PM by Mickey.)
24/01/2009 04:21 PM
Find all posts by this user Quote this message in a reply
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #3
RE: Avatar change on refresh?
Thanks for the fast reply.
I haz the code

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
$input = array("image1.jpg",
#
               "image2.jpg",
#
               "image3.jpg",
#
               "image4.jpg",
#
               "image5.jpg");
#
$site = "http://somesite.com/images/";
#
$random = array_rand($input, 1);
#
echo '<img src="'.$site.$random.'">';; 


What to do with it?


Generic sig goes here.
24/01/2009 04:24 PM
Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #4
RE: Avatar change on refresh?
This is the one ive used.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/*
By Matt Mullenweg > http://photomatt.net
Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
Latest version always at:
http://photomatt.net/scripts/randomimage
*/// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = '';

// Space seperated list of extensions, you probably won't have to change this.
$exts = 'jpg jpeg png gif';

$files = array(); $i = -1; // Initialize some variables
if ('' == $folder) $folder = './';

$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it’s good
++$i;
}
}
}
closedir($handle); // We’re not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along

header('Location: '.$folder.$files[$rand]); // Voila!
?>


You need to host this on a server, any free one will do.


[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
(This post was last modified: 24/01/2009 04:26 PM by Mickey.)
24/01/2009 04:25 PM
Find all posts by this user Quote this message in a reply
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #5
RE: Avatar change on refresh?
Ah wait, I got it.  I'll try this out right now and reply when I'm done.

Generic sig goes here.
24/01/2009 04:27 PM
Find all posts by this user Quote this message in a reply
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #6
RE: Avatar change on refresh?
Bah, I uploaded the php file and the images to my server.  Now what?

Generic sig goes here.
24/01/2009 04:36 PM
Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #7
RE: Avatar change on refresh?
Jaze Wrote:Bah, I uploaded the php file and the images to my server.  Now what?

edit the php file, read the comments "//" to know what to change.
basically upload the image and php files to the same location, then call the php file through the address bar, should display an image.

[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
(This post was last modified: 24/01/2009 04:39 PM by Mickey.)
24/01/2009 04:38 PM
Find all posts by this user Quote this message in a reply
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #8
RE: Avatar change on refresh?
I changed everything.

Generic sig goes here.
24/01/2009 04:38 PM
Find all posts by this user Quote this message in a reply
Mickey
Down with MJ yo

Posts: 3,663.2843
Threads: 251
Joined: 26th Apr 2008
E-Pigs: 28.7300
Offline
Post: #9
RE: Avatar change on refresh?
What's the server's address?

[Image: MiCk3Y.jpg]

[Image: battle.png]

Spoiler for link:
24/01/2009 04:39 PM
Find all posts by this user Quote this message in a reply
-PHENOMENON-
Previously Jaze

Posts: 335.2800
Threads: 29
Joined: 9th Aug 2008
Reputation: 3.706
E-Pigs: 174.8217
Offline
Post: #10
RE: Avatar change on refresh?
http://programmersparadise.co.cc/

The images are in
/images/dis3_mao.png
/images/intro.png

and the php file is in
/images/image_swap.php

Generic sig goes here.
24/01/2009 04:41 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: