Author Topic: Avatar Rotation Script  (Read 2659 times)

0 Members and 1 Guest are viewing this topic.

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Avatar Rotation Script
« on: March 07, 2009, 01:00:50 AM »
Do you ever get bored of having the same old avatar all the time? Too much of a hassel to go out and change it when you want an update?

I recently finished my random avatar script, which allows you to have a number of avatars rotate at a random rate upon every refresh!

Example (refresh this thread to see it in action):



(NOTE-- The above example is MY Colette avatar wheel. No touch! >.<)

Interesting enough? Want to try it? If so, make sure you have your own server or ask a friend that does for space. There are not many free hosts that let you run PHP scripts.

(download attached files)

Snapshot of my source code:
http://img23.imageshack.us/img23/9396/02212009131450.png

Change $path (variable within AvatarControl.php) to any directory (you could even make it hidden like I sorta did) that contains all your image files. Upload avatar.php in any location that you want it to appear in.

You need to name all the images you want to use like so, and place them in the directory you defined in $path:

:
1.png
2.png
3.gif
4.jpg

You can use .png, .gif, .jpg, and .jpeg. If you want to add more, edit $formats (variable within AvatarControl.php) to include it.

You must have only ONE image with a certain number, so you can't have 1.jpg and 1.png in the same folder, otherwise it will NOT load image one. This script was created to RANDOMIZE your avatars, so they'll appear in ANY order.

You can substitute the .php extension in the link to your image with .png by editing .htaccess file or creating a .htaccess file in the directory where avatar.php is and have it contain the following:

:
RewriteEngine on
RewriteRule avatar.png avatar.php

You *might* need to change the paths on that according to how you set it up, but by default it works without the direct paths. ;)
« Last Edit: March 07, 2009, 01:57:05 AM by ccbtimewiz »

Offline bigguy

  • Site Owner
  • Administrator
  • *
  • Posts: 13215
  • Karma: 269
  • Gender: Male
  • Get'r Done
    • P.C. Tweakr
  • SMF Version: 2.0 Gold
Re: Avatar Rotation Script
« Reply #1 on: March 10, 2009, 08:00:53 AM »
Cool, nice little trick ya got there. :)

Offline Smoky

  • who, me?
  • Guru
  • *
  • Posts: 3980
  • Karma: 1450
  • Gender: Female
  • It's all in your HEAD!
    • HangOutSpot
  • SMF Version: 2.0 ??
Re: Avatar Rotation Script
« Reply #2 on: March 11, 2009, 06:38:06 AM »
lol its been spread around enough lol.. CCB knows what i mean.. i think its kewl.. might have to try it out on sigs.. now that would be good too.. hmm...  :hlp :dnc :lmao
Oh wow, guess who dropped by! Im still on secondlife.. but will respond to im's *waves

Offline brianjw

  • Guru
  • *
  • Posts: 2346
  • Karma: 1408
  • Gender: Male
  • What?!?! You mean they're sold out!
Re: Avatar Rotation Script
« Reply #3 on: March 11, 2009, 03:56:47 PM »
I did it on sigs once. It was cool! But me being a graphic wizard they were so high quality *sarcasm* and I deleted them. Lol :)

Offline H

  • New Member
  • *
  • Posts: 43
  • Karma: 332
  • Gender: Male
  • SMF Version: SVN
Re: Avatar Rotation Script
« Reply #4 on: March 22, 2009, 05:49:44 PM »
Looks pretty similar to the script I use, but more polished :P
Huw
Former SMF Support Team Leader

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #5 on: March 22, 2009, 07:33:21 PM »
Looks pretty similar to the script I use, but more polished :P

I wonder why.. :P

Offline lax.slash

  • New Member
  • *
  • Posts: 93
  • Karma: 8
  • Gender: Male
    • LaxSlash Mods, Images, and More
  • SMF Version: SMF 2 BETA 4
Re: Avatar Rotation Script
« Reply #6 on: March 23, 2009, 10:26:18 AM »
Thanks! I use a different version for userbars, but I might have to try this method out.  ;)



PROUD TO BE A REDNECK!

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #7 on: March 31, 2009, 11:37:15 PM »
I've completely rewritten this script.

I'll be updating this post soon.

Offline Smoky

  • who, me?
  • Guru
  • *
  • Posts: 3980
  • Karma: 1450
  • Gender: Female
  • It's all in your HEAD!
    • HangOutSpot
  • SMF Version: 2.0 ??
Re: Avatar Rotation Script
« Reply #8 on: April 01, 2009, 06:06:19 AM »
kewl beans CCB  ;)
Oh wow, guess who dropped by! Im still on secondlife.. but will respond to im's *waves

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #9 on: April 01, 2009, 09:53:11 AM »
Yeah, I managed to cut my code in half and keep the same function-- while allowing you to put avatars of any name instead of using 1.ext, 2.ext, etc.

I'll post my update in a bit. I need to clean/double check the syntax.

Offline H

  • New Member
  • *
  • Posts: 43
  • Karma: 332
  • Gender: Male
  • SMF Version: SVN
Re: Avatar Rotation Script
« Reply #10 on: April 01, 2009, 12:30:21 PM »
Yeah, I managed to cut my code in half and keep the same function-- while allowing you to put avatars of any name instead of using 1.ext, 2.ext, etc.

I'll post my update in a bit. I need to clean/double check the syntax.

Surely that involves scanning the entire directory, which would be incredibly bad for performance if you had many avatars
Huw
Former SMF Support Team Leader

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #11 on: April 01, 2009, 02:20:50 PM »
Surely that involves scanning the entire directory, which would be incredibly bad for performance if you had many avatars

Not so much as glob() searches for all the pathnames matching the pattern that is set.

So it would only scan the directory for image-like files that are defined in the script, and then those images that are found are cached so the script doesn't need to constantly run over and over again. :)

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #12 on: April 02, 2009, 10:03:17 PM »
Here's a screen of my soon-to-be posted script:

http://img27.imageshack.us/img27/6378/04022009215858.png

Offline Link

  • Ninja Hacker
  • Jr. Member
  • *
  • Posts: 147
  • Karma: 485
  • Gender: Male
  • Hyrule's Defender
    • The Ninja's Hideout
  • SMF Version: 2.0 RC2
Re: Avatar Rotation Script
« Reply #13 on: April 03, 2009, 01:54:17 PM »
Wow, TIFF? That'd suck up bandwidth like crazy!
Obedire est vivere, Vivere est obedire


Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Avatar Rotation Script
« Reply #14 on: April 03, 2009, 02:38:33 PM »
TIFF is still an image format.

Likewise, I added it in there as a default option to grab-- you can remove it or not upload any TIFF files in your avatar directory. It's up to you.