Lunarpages Web Hosting Forum

Learn More About Lunarpages Hosting => Web Hosting Tutorials, FAQs and Resources => Topic started by: Danielle on October 10, 2003, 11:41:02 AM

Title: How to have a random avatar in Lunarforums
Post by: Danielle on October 10, 2003, 11:41:02 AM
I just figured out how to have an Avatar on Lunarforums, and then I figured out that I can have it be a random image as well.  On my website homepage, I have random photos each time a person reloads the page, so I already had a cgi script to do this (it can be found at nms Scripts (http://nms-cgi.sourceforge.net/scripts.shtml) under Other Scripts with the name "Random Image")

Once you install the script and get it to work on an html page, use the same code to paste into your Avatar image section in Lunarforums (for example, I pasted "http://www.bestgarden.net/cgi-bin/Avatar.cgi" instead of a jpg/gif listed on my website).  If you would like to do this, too, and can't quite understand how to do the install/configuration of the script, please let me know and I will try to assist.

I know that a random image Avatar might not appeal to some, but it correlates with the gist of my homepage, so I thought it would look nice.  Let me know what you think.

Have a Blessed Day
Title: How to have a random avatar in Lunarforums
Post by: Boris on October 10, 2003, 11:55:09 AM
That's interesting :)

I have never seen users do that in phpbb. I have to say i like it a lot Miraenda :)
Title: How to have a random avatar in Lunarforums
Post by: Martijn on October 10, 2003, 12:16:33 PM
Hehehe, on my own forum I have a dynamic avatar as well. I've created  a small script that actually copies the avatar from the poster right above me, mirrors and inverts it (so it's not exactly the same). A lot of members where pretty amazed! :D
Title: How to have a random avatar in Lunarforums
Post by: Ed on October 10, 2003, 12:20:06 PM
Thats an awsome idea! :-) Must confuse alot of people though!

Speaking of confusing people, I've got a bit of a magic trick myself :-)

http://www.jokeawhenever.com/magic

It gets alot of people! :-)
Title: How to have a random avatar in Lunarforums
Post by: Danielle on October 10, 2003, 12:39:17 PM
Kata, I am dumbfounded.  Your link at http://www.jokeawhenever.com/magic is amazing!  Thanks for sharing.  Now, how do you do it?...  :mrgreen:
Title: How to have a random avatar in Lunarforums
Post by: Coon on October 10, 2003, 12:39:23 PM
I like what you have done with your avatar. Simple but very good.

Kata, how do those sites work? I've seen them before and someone tried to explain to me how they did it, but it didn't make any sense to me.
Title: How to have a random avatar in Lunarforums
Post by: Ed on October 10, 2003, 12:47:28 PM
Since I don't want to spoil it for other people here that see it, I'll PM you guys how it works (even though it goes against the magic rules of secrecy!)

- ed :-)
Title: How to have a random avatar in Lunarforums
Post by: Coon on October 10, 2003, 01:33:10 PM
OK, then I will go ahead and tell everyone how it's done. Scroll down to see.....

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.


Hah! NO! I'm not telling.  :P
Title: How to have a random avatar in Lunarforums
Post by: Boris on October 10, 2003, 01:40:13 PM
It's a script that used to be somewhat popular :)

I used to see it on different websites a couple years back but i've never been able to find the script. So if you wanna share, i'd love you forever ;)
Title: How to have a random avatar in Lunarforums
Post by: Ed on October 10, 2003, 01:41:43 PM
Noooooooo.........
Title: How to have a random avatar in Lunarforums
Post by: Ed on October 10, 2003, 01:43:24 PM
(That last message was in reponse to Coon's message)
Title: How to have a random avatar in Lunarforums
Post by: Coon on October 10, 2003, 02:39:06 PM
LOL, I won't do it Kata. Well, I might, but only if you are really mean to me. Haha, ;)
Title: How to have a random avatar in Lunarforums
Post by: Ed on October 10, 2003, 03:05:52 PM
DOH! :-)
Title: How to have a random avatar in Lunarforums
Post by: MikeBoger on October 11, 2003, 10:21:34 AM
I know how it works.  I know how it works.  Let the bidding begin at $5.  ;)
Title: How to have a random avatar in Lunarforums
Post by: hamburger on November 27, 2003, 03:22:05 PM
Quote from: Kata
Thats an awsome idea! :-) Must confuse alot of people though!

Speaking of confusing people, I've got a bit of a magic trick myself :-)

http://www.jokeawhenever.com/magic

It gets alot of people! :-)

hahaha cool it got me...at first :D
Title: How to have a random avatar in Lunarforums
Post by: mark363 on November 27, 2003, 03:28:33 PM
I know how it works... and I'm willing to go as low as $2.50!! Going once...going twice...   :lol:
Title: How to have a random avatar in Lunarforums
Post by: Danielle on November 27, 2003, 04:09:17 PM
Shh, mussavcom, you don't want Kata to come after you like he did us for telling people ;)  Why do you think I became a site admin, it was b/c they "assimilated" me into the fold of people who know how this works.  Next, they will come after you   :D
Title: How to have a random avatar in Lunarforums
Post by: Ed on November 28, 2003, 02:31:55 PM
HeHe :-)

I am Kata.. I will assimilate you..
Title: How to have a random avatar in Lunarforums
Post by: mark363 on November 28, 2003, 02:58:22 PM
Nooooooooooo!!!  :twisted:
Title: How to have a random avatar in Lunarforums
Post by: mark363 on November 28, 2003, 08:50:54 PM
I did it!  :yey:
Title: How to have a random avatar in Lunarforums
Post by: Danielle on November 28, 2003, 09:03:39 PM
Hi mussavcom,

Glad you like the script.  You will make taglio thrilled, he kept asking me for more cats, and you have cats aplenty ;)  Well, I might add some more cats to mine someday, but I don't like to be whipped about it lol  :whip:
Title: How to have a random avatar in Lunarforums
Post by: Coon on November 28, 2003, 09:39:01 PM
Cool stuff mussavcome. I really like those cats, hehe. :P
Title: How to have a random avatar in Lunarforums
Post by: Ed on November 28, 2003, 11:49:06 PM
LOL.. I"m gonna have to go get a picture of my dog to even things out a little :-)
Title: How to have a random avatar in Lunarforums
Post by: Jwink3101 on November 29, 2003, 08:14:37 PM
I know it but i will not tell for my life, unless you say, "please with a cherry on top"

Then...maybe. I will hint, dfad pide aif drear

What is that, that is my encrypted hint.
Title: How to have a random avatar in Lunarforums
Post by: Jwink3101 on November 29, 2003, 08:17:32 PM
This should be moved to the how-to section for both the original post and the magic trick.
Title: How to have a random avatar in Lunarforums
Post by: Ed on November 29, 2003, 09:53:56 PM
:-)

Well I guess I can sell that secret to the magic trick for $50USD :-)

- Ed
Title: How to have a random avatar in Lunarforums
Post by: Trey on November 30, 2003, 10:29:19 AM
Quote from: Kata
HeHe :-)

I am Kata.. I will assimilate you..


ah, you'll only do that cuz i assimilated you...

<----good at selling and global domination
Title: How to have a random avatar in Lunarforums
Post by: Ripta on March 09, 2004, 12:38:21 PM
Back to the topic of this thread, I'm using a PHP script I wrote myself. This is the source code:

Code: [Select]

<?

/**
* Change the following array to an array of extensions:
* For example, if your images have the extension gif, use:
*   $extensions = array('gif');
* If the extensions are gif and jpg, use:
*   $extensions = array('gif', 'jpg');
* And so on. Don't forget the ; in the end of the line!
**/

$extensions = array('gif', 'jpg', 'jpeg');



/**
* This script should function properly without any changes below.
**/

$avatars = array();
$dh = opendir('.');
$regex = '\.(' . implode('|', $extensions) . ')$';
while(($filename = readdir($dh)) !== false) {
        if (!eregi($regex, $filename)) continue;
        array_push($avatars, $filename);
}
$file = rand(0, count($avatars) - 1);

$handle = fopen($avatars[$file], "r");
$content = "";
while(!feof($handle)) $content .= fgets($handle);
fclose($handle);

echo $content;
?>


Just copy the above to a text editor (such as notepad on Windows) and save as index.php. Now open FTP, create a new directory to put this file on your server so that you can access it through the web. Change directory, and upload the index.php you just saved, along with a bunch of gif and/or jpeg images. This script will take all gif/jpeg images in that directory and choose one randomly. It also works with hotlinking on and you don't need to add http://www.lunarforums.com/ to the hotlinking list.

This script's just for fun :D. Once I get the chance, I might do a script that'll resize stuff. Enjoy! :thumb:
Title: How to have a random avatar in Lunarforums
Post by: Ripta on March 09, 2004, 12:39:31 PM
While I'm on this thread, Trey, how's the global domination going? :D
Title: hehehehe
Post by: martinez on March 12, 2004, 06:04:02 PM
Does anyone not know how it works yet? cuz, I know too... A little secret you can play on people at casino's around three a.m. you don't need a computer, a just quick hand and devilish mind will do the trick. but I won't spoil the fun for everyone...

PM if you'd like to know
Title: How to have a random avatar in Lunarforums
Post by: Stephanie on March 14, 2004, 07:49:28 AM
Quote

Trey , how's the global domination going?

Resistance is futile   8-)
Title: How to have a random avatar in Lunarforums
Post by: Danielle on March 16, 2004, 07:52:48 AM
Quote from: binary
Just copy the above to a text editor (such as notepad on Windows) and save as index.php. Now open FTP, create a new directory to put this file on your server so that you can access it through the web. Change directory, and upload the index.php you just saved, along with a bunch of gif and/or jpeg images. This script will take all gif/jpeg images in that directory and choose one randomly. It also works with hotlinking on and you don't need to add http://www.lunarforums.com/ to the hotlinking list.

This script's just for fun  :D . Once I get the chance, I might do a script that'll resize stuff. Enjoy!  :thumb:


Hey Ripta, thanks for writing the script and I actually switched over to using it instead.  It has a lot of benefits over the cgi one and this is why I am going to recommend it to people:

1) You can simply place the files in the folder that the index.php script is located in, and you don't have to worry about misspelling the file names, which causes the images not to display sometimes.  Also, any new images simply need to be uploaded and they are automatically available to display; the cgi script required them to be manually typed.
2) Due to it being an index file, you only have to put the folder name for the link (so mine is http://bestgarden.net/Avatar/ for the link)
3) It doesn't have to be in the cgi-bin, so greater flexibility for the script.
3) Heck, it's php and that is so much cooler than cgi/perl anyway.

So, thanks again and hopefully the occasional red x issues with my pics will now disappear forever.  :yey:

Have a Blessed Day
Title: How to have a random avatar in Lunarforums
Post by: Ripta on March 28, 2004, 11:38:29 PM
Woo hoo... my script is Danielle Approved and Recommended :D. *passes out from excitement*.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 09, 2004, 10:55:10 AM
Quote from: Ed
Thats an awsome idea! :-) Must confuse alot of people though!

Speaking of confusing people, I've got a bit of a magic trick myself :-)

http://www.jokeawhenever.com/magic

It gets alot of people! :-)


OMG! I tried it 2x and it worked. Freaky. Cool trick.  :yey:
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 09, 2004, 11:16:50 AM
Quote from: Ripta
Back to the topic of this thread, I'm using a PHP script I wrote myself.
This script's just for fun :D. Once I get the chance, I might do a script that'll resize stuff. Enjoy! :thumb:


Thanks for sharing your script, Ripta! It worked wonderfully... and was so easy to set up! :yey:
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 09, 2004, 11:35:47 AM
Quote from: TranzNDance
Quote from: Ripta
Back to the topic of this thread, I'm using a PHP script I wrote myself.
This script's just for fun :D. Once I get the chance, I might do a script that'll resize stuff. Enjoy! :thumb:


Thanks for sharing your script, Ripta! It worked wonderfully... and was so easy to set up! :yey:


:D Glad you liked it :thumb:
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 09, 2004, 12:59:03 PM
Quote from: TranzNDance
Quote from: Ed
Thats an awsome idea! :-) Must confuse alot of people though!

Speaking of confusing people, I've got a bit of a magic trick myself :-)

http://www.jokeawhenever.com/magic

It gets alot of people! :-)


OMG! I tried it 2x and it worked. Freaky. Cool trick.  :yey:


awww. I figured it out. It was more fun when I did not know how it worked. I guess the detective in me couldn't accept things at face value.  :| It's still a neat trick. :thumb:
Title: How to have a random avatar in Lunarforums
Post by: Danielle on May 09, 2004, 02:04:53 PM
Yes, but now the fun comes in showing it to others to see how long it takes them to figure it out ;)
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 12, 2004, 05:14:49 PM
I don't know if it's my stupidty, or what, but the script does not work for me neither on my personal development server or on the webserver

All I get is the all too well known red X.  I uploaded like 5 pictures with jpg and gif extensions, and notta.
http://www.richgannon.net/avatar/

Do the images need special names or am I missing something or what?
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 12, 2004, 05:21:34 PM
Are the images in the same folder as the index file? They don't need special names, unless they have non-standard names.
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 12, 2004, 05:38:10 PM
I have 4 images uploaded to the same directory as the index file.

ava1.gif
ava2.jpg
ava3.jpg
ava4.jpg

Are these non-standard names?
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 12, 2004, 05:45:20 PM
Those seem like reasonable names. Do those images work anywhere else? I was thinking hotlink protection would interfere with them working in these forums, but those images don't show up on your own domain in that folder. :?
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 12, 2004, 05:48:07 PM
They do work...so I am at a loss.

www.richgannon.net/avatar/ava1.gif

www.richgannon.net/avatar/ava2.jpg

www.richgannon.net/avatar/ava3.jpg

www.richgannon.net/avatar/ava4.jpg
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 12, 2004, 06:18:05 PM
Did you edit the code? Have you tried starting over? Copy the code to a new file, name it index.php? I know you already have one, but it doesn't seem to be working.
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 03:45:57 AM
I keep getting this error

Quote

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /public_html/rand/index.php on line 2

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /public_html/rand/index.php on line 2

Parse error: parse error in /public_html/rand/index.php on line 2


This is my exact coding from the index file.
Quote

<?

/**
* Change the following array to an array of extensions:
* For example, if your images have the extension gif, use:
* $extensions = array('gif');
* If the extensions are gif and jpg, use:
* $extensions = array('gif', 'jpg');
* And so on. Don't forget the ; in the end of the line!
**/

$extensions = array('gif', 'jpg');



/**
* This script should function properly without any changes below.
**/

$avatars = array();
$dh = opendir('.');
$regex = '\.(' . implode('|', $extensions) . ')$';
while(($filename = readdir($dh)) !== false) {
if (!eregi($regex, $filename)) continue;
array_push($avatars, $filename);
}
$file = rand(0, count($avatars) - 1);

$handle = fopen($avatars[$file], "r");
$content = "";
while(!feof($handle)) $content .= fgets($handle);
fclose($handle);

echo $content;
?>


??? :?
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 04:24:55 AM
Ok, I tried d/ling Danielle's & Ripta's index.php file, but it trying to save as will just save the image file the script is putting out.

I don't know why/how my script isn't working. but if I could compare a working script file to my own perhaps I could figure it out.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 13, 2004, 04:32:07 AM
Yeah, you can't get their index files that way.

I tried the code exactly as you had pasted it, and it works just fine:
http://www.tu2.net/test/avatar/index.php

Do you have the index file in the same folder as the graphics, or was the error message just an example? In the error msg, the index file was in subdir "rand" but your images are in "avatar"

That ascii reference makes me wonder if there was an error in uploading via FTP. Have you been able to upload other php files that worked?
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 04:40:58 AM
The index file is in the same folder as the images, the images & index file are in the directory /rand.

No, this would be my first php file ever uploaded. I use WS_FTP, should I upload in binary?
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 04:43:34 AM
Bah, I just uploaded in ascii instead of binary, now I'm getting this

Quote
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fcharset0 Times New Roman;}{\f1\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\sb100\sa100\f0\fs24 \line\line /** \line * Change the following array to an array of extensions: \line * For example, if your images have the extension gif, use: \line * $extensions = array('gif'); \line * If the extensions are gif and jpg, use: \line * $extensions = array('gif', 'jpg'); \line * And so on. Don't forget the ; in the end of the line! \line **/ \line\line $extensions = array('gif', 'jpg'); \line\line\line\line /** \line * This script should function properly without any changes below. \line **/ \line\line $avatars = array(); \line $dh = opendir('.'); \line $regex = '\\.(' . implode('|', $extensions) . ')$'; \line while(($filename = readdir($dh)) !== false) \{ \line if (!eregi($regex, $filename)) continue; \line array_push($avatars, $filename); \line\} \line $file = rand(0, count($avatars) - 1); \line\line $handle = fopen($avatars[$file], "r"); \line $content = ""; \line while(!feof($handle)) $content .= fgets($handle); \line fclose($handle); \line\line echo $content; \line ?>\par \pard\f1\fs20\par }


Err, that was a differently edited file( I tried fixing the problem myself) I uploaded in ascii on the correct file and I still get the same error
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 13, 2004, 04:51:01 AM
What did you paste the text to? It looks like a Word or MS-wannabe-html editor. How about just copying and pasting the code to Notepad, save as index.php, and upload via ftp. According to Hush's post (http://www.lunarforums.com/forum/viewtopic.php?p=55040#55040), you should use ASCII mode.
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 04:51:44 AM
:)  :)

All is working now. After seeing
Quote

Times New Roman;}{

In the one error, I guessed it had something to do with wordpad not being written to php, and implementing .doc properties into the file. So I transferred one of my php files over from my forum & just replaced the code with Ripta's.

Works like a charm now  :yey:
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 13, 2004, 04:57:49 AM
Ok, when you use Wordpad, make sure to save as text-only. Some people recommend against using wordpad because of the extra properites. However, I prefer the better interface and functionality of WordPad over NotePad. As long as I save as text only, I don't have problems and I don't have the frustrations of working with Notepad.

Glad to know things are working.  :thumb:
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 13, 2004, 05:00:40 AM
Thanks, me too. I think I'll finally go to sleep now.
(Get stuck on one thing and can't move till I get it figured out)

And thanks for the info on wordpad & notepad, [future reference] now I'll know what to do.
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 13, 2004, 08:19:04 AM
Additionally, make sure there are NO spaces or newlines before the <? sign or after the ?> in the code.
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 13, 2004, 12:27:57 PM
I still have no luck.  Does it maybe matter on the PHP settings ( heres my PHP info: http://richgannon.net/info.php )?  Any idea what could be casuing this not to work?

And I copied the exact code that Ripta has posted:
Code: [Select]
<?

/**
* Change the following array to an array of extensions:
* For example, if your images have the extension gif, use:
*   $extensions = array('gif');
* If the extensions are gif and jpg, use:
*   $extensions = array('gif', 'jpg');
* And so on. Don't forget the ; in the end of the line!
**/

$extensions = array('gif', 'jpg', 'jpeg');



/**
* This script should function properly without any changes below.
**/

$avatars = array();
$dh = opendir('.');
$regex = '\.(' . implode('|', $extensions) . ')$';
while(($filename = readdir($dh)) !== false) {
        if (!eregi($regex, $filename)) continue;
        array_push($avatars, $filename);
}
$file = rand(0, count($avatars) - 1);

$handle = fopen($avatars[$file], "r");
$content = "";
while(!feof($handle)) $content .= fgets($handle);
fclose($handle);

echo $content;
?>


NOTE: I have also tried replacing $dh = opendir('.');  with the full path to directory: $dh = opendir('/homepages/36/d90853950/htdocs/avatar/ '); getting the same output of no images showing up...
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 13, 2004, 12:56:56 PM
RPG, where did you copy the code? Did you see the problem p0tter had? Could it be related?

I just realized I was talking to 2 different people when I thought it was just one. :oops: That's why I asked p0tter about the 2 different subdirs. Sorry! My brain is fried.
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 13, 2004, 01:15:07 PM
I did see what p0tter had, but it is not related.  The index.php file is parsed correctly, but just for some funny reason does not give me any image, but it seems to be trying to with the red X there.

http://richgannon.net/avatar/
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 08:22:23 PM
It seems to be working right now.
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 14, 2004, 08:28:20 PM
If so, then I am at a loss, cause all I see it the red X.

http://richgannon.net/avatar.jpg is exactly what I see when going to the link.
Title: How to have a random avatar in Lunarforums
Post by: Tracie on May 14, 2004, 08:39:52 PM
I see a red x too. Not the answer you want to hear, I know, but at least you know it's not just you.

I'm baffled as to why it's not working though...
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 14, 2004, 10:09:40 PM
its just gotta be something with PHP settings...No other explanation.  i know my dev server runs with PHP safe mode enabled.  What about LP servers?
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 10:09:47 PM
Quote from: RPG
If so, then I am at a loss, cause all I see it the red X.

http://richgannon.net/avatar.jpg is exactly what I see when going to the link.


Can you please do a screenshot of the FTP view of the /avatar directory? I assume richgannon.net is not on our servers?
Title: How to have a random avatar in Lunarforums
Post by: Danielle on May 14, 2004, 10:10:37 PM
I don't see a red x, I see the code of the image. Are you certain that the images themselves aren't the issue? Did you upload the images in binary mode or ASCII mode? Here is a link that tells you what ftp modes for different types of files:

http://www.lunarforums.com/forum/viewtopic.php?t=10227
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 10:10:46 PM
Quote from: RPG
its just gotta be something with PHP settings...No other explanation.  i know my dev server runs with PHP safe mode enabled.  What about LP servers?


We never enable safe-mode. Some servers have disabled_functions != NULL, but that wouldn't pose a problem.
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 10:11:17 PM
Quote from: Danielle
I don't see a red x, I see the code of the image. Are you certain that the images themselves aren't the issue? Did you upload the images in binary mode or ASCII mode? Here is a link that tells you what ftp modes for different types of files:

http://www.lunarforums.com/forum/viewtopic.php?t=10227


Let me guess.. Firefox, too?
Title: How to have a random avatar in Lunarforums
Post by: Danielle on May 14, 2004, 10:11:58 PM
Yes, Firefox
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 10:14:08 PM
Quote from: Danielle
Yes, Firefox


Well, yeah. Same here. MSIE would not try to display it in the first place.
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 14, 2004, 10:15:53 PM
Quote from: Ripta
Quote from: RPG
its just gotta be something with PHP settings...No other explanation.  i know my dev server runs with PHP safe mode enabled.  What about LP servers?


We never enable safe-mode. Some servers have disabled_functions != NULL, but that wouldn't pose a problem.


Make sure you upload in ASCII, as people have said. Make sure you have NO extra spaces before <? and ?>. Extra spaces include newlines, linefeeds, tabs, spaces, ....
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 14, 2004, 11:50:18 PM
I tried in 4 browsers. Here's how they look.
http://www.tu2.net/test/avatar/random-screens.JPG
(remember that IE tends to automatically shrink images, if you have trouble seeing the screen shot)

The only English words I can pick out are  
adobe:docid:photoshop:
3.0ESliceTypeleftOutsetlong

RPG ,

Do those ring any bells?
Title: How to have a random avatar in Lunarforums
Post by: p0tter on May 15, 2004, 01:14:38 AM
With the errors I'm seeing(Tranzndance's) it looks like that same problem I was having. Somewhere in the upload process (upload type[binary/ascii] or a problem with notepad/what ever he used to copy-paste) is causing a problem.

If you'd like, PM and I'll send you my index.php file and then see if that works.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on May 15, 2004, 01:38:57 AM
RPG,

When I saw that adobe text, I thought there was something to do with the images, so I thought I would experiment with your images. I set up a directory where I have copies of the avatars you wanted to use. I copied and pasted the code that you posted that you were using. It works:
http://www.tu2.net/test/rpg

Could you please describe step-by-step what you did once you copied the code? In what application do you paste? Do you save as text only? What do you use to FTP? What mode--ASCII or binary?
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 15, 2004, 05:34:55 AM
Well its not the images, and all FTP is uploaded properly, as it is working....just the PHP is not showing the images properly :-?

And no, it is not on LP- servers.
Title: How to have a random avatar in Lunarforums
Post by: Ripta on May 15, 2004, 05:36:41 AM
Quote from: RPG
Well its not the images, and all FTP is uploaded properly, as it is working....just the PHP is not showing the images properly :-?

And no, it is not on LP- servers.


Change the filename from index.php to index.txt. Therefore, we can see the source of whatever's uploaded :D
Title: How to have a random avatar in Lunarforums
Post by: RPG on May 15, 2004, 02:24:06 PM
done http://richgannon.net/avatar/index.txt
Title: How to have a random avatar in Lunarforums
Post by: Mocca on July 04, 2004, 10:37:53 PM
Thankyou to cooleo100d for pointing me to this thread  :)

Sorry to dig it back up again, but I am having problems :-( I have coped that code exactly, pasted it in Notepad and saved it as index.php. I uploaded that and 2 images (both .gifs) to a new directory I made and then tried to go to that address - all I can see is a page full of what I think is code?

Quote
GIF89acR`.eRb5(XP@@b '


lots and lots of that... what did I do wrong?
Title: How to have a random avatar in Lunarforums
Post by: Mocca on July 05, 2004, 12:25:24 AM
No idea what I did but it's working now. For some reason I can't go directly to the page using Firefox, but I tried it in Explorer and it worked so I put it on my forum and wha-laa rotating avatar.

Thankyou for that script...  :love:
Title: How to have a random avatar in Lunarforums
Post by: confused on July 05, 2004, 05:56:47 PM
whoa shoot. How did it do that? I still dont get it....somebody want to explain? Thanks, confused!
Title: How to have a random avatar in Lunarforums
Post by: Guzik on August 14, 2004, 09:52:17 PM
Bah - animated avatars are greater than "changing" ones..  :evil:
Title: How to have a random avatar in Lunarforums
Post by: hamburger on August 19, 2004, 06:40:13 PM
Quote from: Mocca
Thankyou to cooleo100d for pointing me to this thread  :)

Sorry to dig it back up again, but I am having problems :-( I have coped that code exactly, pasted it in Notepad and saved it as index.php. I uploaded that and 2 images (both .gifs) to a new directory I made and then tried to go to that address - all I can see is a page full of what I think is code?

Quote
GIF89acR`.eRb5(XP@@b '


lots and lots of that... what did I do wrong?


This is correct as it just writes the content of the script to the screen(open up a small image in notepad and youll see the same thing)-ie must realise its meant to be an image.
You have to link to the image to display it, ie:
Code: [Select]

<img src="randomimage.php">





I have a problem, mine works but i cant get it to work in this forum,
this is the php file:
http://www.human.lunarpages.com/myimages/avatar/lp/

but when i past it into
Link to off-site Avatar
in profile nothing changes, it justs leaves it as the last one i uploaded.
ie rzawar.jpg :S
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 19, 2004, 06:50:48 PM
You just need to put http://www.human.lunarpages.com/myimages/avatar/lp/ in the field where you put the image file location. I am able to see the file fine when I access it directly.

Your avatar is using this URL:
http://www.human.lunarpages.com/myimages/avatar/lp/rzawar.jpg so it won't change. Are we talking about the same script here?
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 06:58:17 AM
Odd, I got mine working, but it only works in IE ... anyone else here having problems seeing this in Mozilla and/or Firefox?


Edit: I don't have mine here in my profile yet.  The avatars/script is located at http://www.thecovenorganization.com/avatar/ -- I wasn't gonna add it to my profile until I could see it in my "native" browser, which is usually FireFox.

Something else I thought of, I can see the images of the rest of you using this script (Ripta's) just fine in Mozilla and FireFox ... just wondering why I can't see my own.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 07:06:50 AM
I see what you mean, nitallica.

Did you upload the php file as ASCII? Did you use a text editor to edit the script? Did you save as text-only?
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 07:08:45 AM
I up'd the PHP file as ASCII, and the images are all binary (these are set as default in my FlashFXP).  I created the PHP file in Ultraedit as a plain text file and renamed to index.PHP.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 07:16:23 AM
Quote from: nitallica
I up'd the PHP file as ASCII, and the images are all binary (these are set as default in my FlashFXP).  I created the PHP file in Ultraedit as a plain text file and renamed to index.PHP.

Ah. I tried changing my file to .PHP from .php

with .PHP
my avatar stopped working in both browsers when viewed in the forums. IE showed an X and FF showed nothing. Direct access resulted in the image showing in IE, but nothing in FF.

with .php:
In FF, when I try to view the avatar directly, it spits out gibberish, whereas IE shows the image. The avatar shows up in both forums.

In conclusion, rename to index.php :) In general, keep filename extensions lowercase.
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 07:18:15 AM
Actually, everything's in lowercase already.  I always upload everything as lowercase.  I typed it out in my previous post as uppercase just out of habit, sorry.


<pout>I want random silliness for my avvie too! :( </pout>

hehehe
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 07:22:17 AM
Well, then things should be working because the browsers are behaving as I described when the file is index.php. Now, just put the URL in the avatar field in your profile.
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 07:26:14 AM
I tried already, it wouldn't replace my old avvie, so I deleted the old image and tried again ... no dice.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 07:29:34 AM
So, in the "Link to off-site Avatar:" field you entered http://www.thecovenorganization.com/avatar/ ? Did you refresh the page because it might have been showing your current avatar since it is one of the images in the folder.
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 07:57:29 AM
Yes, and Yes.  :(

I gotta work on it later though ... my boss wants some graphics for his kid's softball team t-shirts done, so I'll be back later tonight.

Thanks for your help. :D
Title: How to have a random avatar in Lunarforums
Post by: GMTurner on August 20, 2004, 08:26:52 AM
Not sure if anyone answered the question about direct linking versus <img> link, but it has to do with IE guessing at the proper mime-type when you go straight to the page. Since the first few characters of the file generally contain GIF, JPEG, etc. windows recognizes the file type and tries to encode it properly within IE. With FF the browser has to be told what the content-type (mime-type) is for a direct link, otherwise it treats everything as text. If the link is made from an <img> reference though, then FF knows to interpret it as an image, so it works. For example, if your right click on Tranz's avatar in FF and select View image, you get the code of the image rather than the image displaying properly like it does in the forums...

An additional few lines of code to ripta's script could make it send the proper content-type for a direct link in FF, so if anyone wants those lines for some reason just let me know... I used to have something similar on my galleries pages which displayed a random image before I switched to thumbnail views instead...

- Marc
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 08:31:58 AM
Thanks for the explanation, GMTurner. :thumb:
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 09:01:25 AM
Quote from: GMTurner
An additional few lines of code to ripta's script could make it send the proper content-type for a direct link in FF, so if anyone wants those lines for some reason just let me know... I used to have something similar on my galleries pages which displayed a random image before I switched to thumbnail views instead...

- Marc



Ah, I would love to have that code, please please.  :love:
Title: How to have a random avatar in Lunarforums
Post by: GMTurner on August 20, 2004, 10:07:22 AM
Here's the code to add... place it right before the "echo $content;" line:

Code: [Select]

$ext = substr("$avatars[$file]",-4);
switch ($ext) {
case ".gif":
Header("content-type:image/gif");
break;
case ".jpg":
Header("content-type:image/jpeg");
break;
};


This only does it for gif & jpg files, so if you have files using other extensions you'll need to add those in as well...
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 11:16:01 AM
YAY!!!  GMTurner, you are a DOLL!  Thank you. :D :yey:  :love:
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 11:19:22 AM
How odd though ... when I put http://www.thecovenorganization.com/avatar/ in the Link to off-site Avatar field, it will not accept it ... is there something else I need to be doing?

(I even tried http://www.thecovenorganization.com/avatar/index.php just for grins and giggles ... no dice. :()
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 11:34:59 AM
I've noticed that when I try to put my new link in the Link to off-site Avatar field, I get the turquoise box at the top of the screen that you'd normally see error messages in, but there's nothing in it ... anyone else get that?
Title: How to have a random avatar in Lunarforums
Post by: leighsww on August 20, 2004, 12:04:36 PM
Nitallica, do you have Hotlinks Protection on?  If you do, you need to add LF's URL in the allow URLs.  So, add this:

http://www.lunarforums.com

And you should then see your avatar show up here.
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 12:15:32 PM
hrm ... I hadn't thought of that, I just added it, but it's still not showing. :(
Title: How to have a random avatar in Lunarforums
Post by: GMTurner on August 20, 2004, 12:15:40 PM
I'm feelin' the love :)

Not sure why it isn't working for you, but to test I tried it using your url and got the same result you did.

- Marc

EDIT- And the same result if I try using the path to Tranz's random avatar script...
Title: How to have a random avatar in Lunarforums
Post by: leighsww on August 20, 2004, 12:26:37 PM
Quote from: Nitallica
hrm ... I hadn't thought of that, I just added it, but it's still not showing. :(

Here's what it says in the "Alternate" when I look at the properties of your image:

Quote
The image http://www.thecovenorganization.com/avatar/ cannot be displayed, because it contains errors.
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 12:46:59 PM
*pout* :(
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 01:07:32 PM
ok ... so any suggestions, or am I SOL?
Title: How to have a random avatar in Lunarforums
Post by: rpassmore on August 20, 2004, 01:15:07 PM
[chant]SOL     SOL     SOL    SOL    SOL    SOL    SOL....[/chant]

 :abduct:
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 01:18:56 PM
LOL, thought so ... no biggie, time for me to come up with an original avvie anyways. :D
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on August 20, 2004, 01:22:52 PM
I tried both Nitallica and my URL in my own forums (didn't want to confuse people here) last night and got some blank box at the top of the page but have no idea what the cause is. My old, static avatar was still there.

I wonder if there's something about phpBB 2.0.10 and that those of us who made the change before then got grandfathered. :?
Title: How to have a random avatar in Lunarforums
Post by: Nicki Faulk on August 20, 2004, 02:12:58 PM
Dunno, TranzNDance, I had wondered about that too ... no biggie though.  Thanks for all of y'all's help.  :D
Title: How to have a random avatar in Lunarforums
Post by: hamburger on August 20, 2004, 05:40:54 PM
Quote from: TranzNDance
You just need to put http://www.human.lunarpages.com/myimages/avatar/lp/ in the field where you put the image file location. I am able to see the file fine when I access it directly.

Yes ive tried that but it wont change to that URL it just stays as the last image i entered. I know that this script works because ive tested it at various placed,
phpBB just wont seem to update to that URL.

Quote from: TranzNDance

Your avatar is using this URL:
http://www.human.lunarpages.com/myimages/avatar/lp/rzawar.jpg so it won't change. Are we talking about the same script here?


Yes its the same script, i just changed to to rzawar.jpg to make sure i could change my avatar to something since it wont let me change to the php script.

For example i changed my avatar to this(which doesnt exist)
http://shutuewreeew.com/paslkls.jpg
when i do that it says profile updated succesfully,
but when i change it to:
http://www.human.lunarpages.com/myimages/avatar/lp/
it doesnt change say profile updated i just get returned to the profile edit screen

I dont know :S
Title: How to have a random avatar in Lunarforums
Post by: donavin410 on September 03, 2004, 09:53:05 PM
Quote from: human2.0
Quote from: TranzNDance
You just need to put http://www.human.lunarpages.com/myimages/avatar/lp/ in the field where you put the image file location. I am able to see the file fine when I access it directly.

Yes ive tried that but it wont change to that URL it just stays as the last image i entered. I know that this script works because ive tested it at various placed,
phpBB just wont seem to update to that URL.

Quote from: TranzNDance

Your avatar is using this URL:
http://www.human.lunarpages.com/myimages/avatar/lp/rzawar.jpg so it won't change. Are we talking about the same script here?


Yes its the same script, i just changed to to rzawar.jpg to make sure i could change my avatar to something since it wont let me change to the php script.

For example i changed my avatar to this(which doesnt exist)
http://shutuewreeew.com/paslkls.jpg
when i do that it says profile updated succesfully,
but when i change it to:
http://www.human.lunarpages.com/myimages/avatar/lp/
it doesnt change say profile updated i just get returned to the profile edit screen

I dont know :S


If you are using a cgi script, then your image path should end with "whatever.cgi"

Here is the one I use on my web site forum, and it works great...

http://d-410.com/cgi-bin/avatarx52.cgi


I have also used that on invision board and it worked there aswell.
Title: How to have a random avatar in Lunarforums
Post by: Arngautr on September 03, 2004, 10:44:36 PM
I have a random avatar (sort of)...
Title: How to have a random avatar in Lunarforums
Post by: Arngautr on September 03, 2004, 10:45:02 PM
see!  Does this count?  I should edit it some more and animate it to make it actually spin opposite ways.
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on September 06, 2004, 11:51:53 PM
You have a neat AV,Arngautr :thumb: At first, I thought it was part of the LF layout because it was so subtle... Did you design it with the LF colors in mind?
Title: How to have a random avatar in Lunarforums
Post by: Arngautr on September 06, 2004, 11:58:46 PM
Yes, I ganked the rgb values from this site, drew some lines with them in the gimp hit a filter, played with layers and masking and stuff and spit this out.  I only wish the colors were more contrasting, but a little animation should differintiate them and make them show up better.  I would have done this already but my 2D animation software sucks, maybe later in the week.
Title: How to have a random avatar in Lunarforums
Post by: GarveysIT on September 07, 2004, 12:10:17 AM
i think i looks really cool :yey:
Title: How to have a random avatar in Lunarforums
Post by: Chelle on November 19, 2004, 12:15:07 PM
Bringing this back up.  I'm using Ripta's php script.  It works fine when I load the url in a browser, however when I put it into the off site Av in my forum profile [at my site]  it won't update.  I tried doing it via admin CP and it tells me:

The URL of the remote avatar is not valid

That URL I tried is:

http://www.donnieyen.us/dyna_avy/chelle/index.php

And even

http://www.donnieyen.us/dyna_avy/chelle/

What setting in my forum do I need to change so it will allow that URL??

P.S. the site I'm referring to is http://forums.donnieyen.us
Title: How to have a random avatar in Lunarforums
Post by: TranzNDance on November 19, 2004, 12:18:55 PM
Are you using phpbb 2.0.10? It has a security change that only allows actual image files to be set for the AV. Those who already have it set will be able to use scripted AVs. Someone was able to tweak phpbb to make it allow scripts...
Title: How to have a random avatar in Lunarforums
Post by: Chelle on November 19, 2004, 12:21:26 PM
Yup it's 2.0.10

I figured it was a secuirty deal when it said it wasn't a valid URL.  Wouldn't happen to know where that tweak was?  

Looks like I'll have to pull out ze almighty search -nod-
Title: How to have a random avatar in Lunarforums
Post by: GMTurner on November 19, 2004, 01:43:23 PM
sent you a PM about this...
Title: How to have a random avatar in Lunarforums
Post by: Lupine1647 on November 19, 2004, 02:01:51 PM
What i did was create a redirect from a .gif file to point it to the script.
Title: How to have a random avatar in Lunarforums
Post by: Chelle on November 19, 2004, 02:14:13 PM
Thanks all.   Got it to play nice -dances-
Title: How to have a random avatar in Lunarforums
Post by: Dark Side on February 05, 2005, 08:43:39 PM
Hmmm, this is interesting. Think I'll give it a try.
Title: How to have a random avatar in Lunarforums
Post by: S.R.U. on May 10, 2005, 05:59:28 AM
i did that with my sig:
(http://www.srudesigns.com/sig.jpg)
well the url shows http://www.srudesigns.com/sig.jpg but atually the url is http://www.srudesigns.com/sig.jpg/index.php
so sig.jpg is the name of the folder
Title: How to have a random avatar in Lunarforums
Post by: hamburger on May 14, 2005, 03:53:07 AM
yay  :yey:
i just wrote my own dynamic signature!!!!
It needs work, i.e the graphic and font, but im just glad i got the content there:
it parses RSS (xml file) on my site and displays the lastest entry.
Couldnt have done it without this thread.
Thanks!
Title: How to have a random avatar in Lunarforums
Post by: GMTurner on May 14, 2005, 06:37:23 AM
Good job :)
Title: How to have a random avatar in Lunarforums
Post by: Chelle on June 12, 2005, 06:35:00 PM
Quote from: Lupine1647
What i did was create a redirect from a .gif file to point it to the script.


How? .htaccess?  I'm thinking this method will help solve something and want to give it a whirl.
Title: How to have a random avatar in Lunarforums
Post by: Lupine1647 on June 12, 2005, 06:38:19 PM
The redirect option in the Cpanel will do, in hence the CPanel redirect thing modifies the htaccess file.
Title: Re: How to have a random avatar in Lunarforums
Post by: Lupine1647 on October 24, 2006, 03:19:47 PM
Tis' some code for RAT.

Code: [Select]
<?
header('Content-type: image/jpeg');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

// ex. /home/cpanel/av/
$directory="PATH TO FOLDER";

$dir=opendir($directory);

$pattern="\.(gif|jpg|jpeg|png)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);

//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
$size=getimagesize("$directory$image[$randNum]");
$av=readfile("$directory$image[$randNum]");
echo "$av";
?>
Title: Re: How to have a random avatar in Lunarforums
Post by: RandyT on October 24, 2006, 08:24:48 PM
OK, here is the code I am trying to use:

Code: [Select]
<?
header('Content-type: image/jpeg');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

// ex. /home/cpanel/av/
$directory="/home/cpanelusername(not included for security reasons)/public_html/randomimages/
";

$dir=opendir($directory);

$pattern="\.(gif|jpg|jpeg|png)$";
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);

//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
$size=getimagesize("$directory$image[$randNum]");
$av=readfile("$directory$image[$randNum]");
echo "$av";
?>

there is a folder inside my public_html called "randomimages" that contains the images, then I added this to my .htaccess:

Code: [Select]
RewriteEngine On  RewriteRule ^images.jpg /images.php [L]


and put this link in my forum profile:

http://mydomain.com/images.php

which gives the following error:

Warning: opendir(/home/cpanelusername(left out for security reasons)/public_html/randomimages/ ) [function.opendir]: failed to open dir: No such file or directory in /home/cpanelusername/public_html/images.php on line 19
Failed to read directory

Any ideas on why this isnt working ?

thanks,
RandyT






Title: Re: How to have a random avatar in Lunarforums
Post by: hamburger on October 25, 2006, 01:06:05 AM
the link in your forum profile should be http://mydomain.com/images.jpg and not .php, that probably won't help.
I looked at your site and it wasn't giving me that error, just displaying the link.
Title: Re: How to have a random avatar in Lunarforums
Post by: Lupine1647 on October 25, 2006, 05:10:30 PM
Randy, I'll make some new code for ya in a bit.
Title: Re: How to have a random avatar in Lunarforums
Post by: RandyT on October 25, 2006, 05:35:57 PM
Awesome, thanks  :thumb:

RandyT
Title: Re: How to have a random avatar in Lunarforums
Post by: Lupine1647 on October 25, 2006, 06:14:40 PM
I modified it a little bit:

Code: [Select]
<?
// Set type
header('Content-type: image/gif');
// Headers to not cache the image
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");

// CONFIGURATIONS
$directory="/home/CP/public_html/randomimages/";
$pattern="\.(gif|jpg|jpeg|png)$";

// Get file list
if(!is_dir($directory)){
die("Directory: $directory is not valid.");
}

$dir=@opendir($directory);
if(!$dir)
{
die("Failed to read directory");
}
$s=readdir($dir);
$count="0";
$image;
while($s)
{
if(ereg($pattern, $s))
{
$image[$count]=$s;
$count++;
}
$s=readdir($dir);
}
closedir($dir);

//Spit it out
$limit=count($image);
$limit--;
$randNum=rand(0,$limit);
readfile("$directory$image[$randNum]");
?>
Title: Re: How to have a random avatar in Lunarforums
Post by: RandyT on October 25, 2006, 06:30:53 PM
Working like a charm now Ryan  :thumb:

Many thanks and Happy Halloween !

RandyT
Title: Great!!!
Post by: beltalcom on December 05, 2007, 09:21:19 PM
I did it ! Great (http://www.beltal.com) !