jlhaslip
Oct 8 2007, 07:04 AM
In case you haven't noticed, I have a different Avatar display on the Forum each time the page is refreshed.  For those of you who might want the script to do that, here is the one I am using: HTML < ? php // lose the spaces $filesp = glob('*.png'); if(empty($filesp)){ echo 'no images found...die<br>'; die(); } else{ foreach ($filesp as $file) { $img_array[] = trim($file); } } shuffle($img_array); //select image at random header("C o n t e n t{dash}t y p e: image/png"); // replace the {dash} and lose the spaces $image = $img_array[0]; $image = imagecreatefrompng( "$image" ); imagepng($image); imagedestroy($image); ?> How the script worksCODE $filesp = glob('*.png'); if(empty($filesp)){ echo 'no images found...die<br>'; die(); } The png files are found and stored into a variable using the glob function by matching the last four characters of the filename. I there are no png files found, the script dies. CODE foreach ($filesp as $file) { $img_array[] = trim($file); } } shuffle($img_array); //select image at random The loop stores the file names into an array which is then shuffled to randomize the list. CODE header("C o n t e n t{dash}t y p e: image/png"); // replace the {dash} and lose the spaces $image = $img_array[0]; $image = imagecreatefrompng( "$image" ); imagepng($image); imagedestroy($image); The header for the file type png is output to tell the receiving Bowser what to expect, then the first element of the array is chosen for creation, and the image is output and destroyed. ImplementationSave this script as a file named index.php. Place the index.php file into a folder named image.png (yes, that's correct) and load all the png format Avatars into the same folder. The images must be png files for this to work properly. Call the script using http://your-domain/folder-path/image.png as the name of the image you want to display and the script finds all the png files in the folder, shuffles them up and spits out the first one in the list. How cool is that???In order for this to work, you need a Hosting space that allows php code and a method to upload the files and images. You can use any size of image that you want, but many Forums only allow a 90 px x 90 px size, so I would stick to that size for the images. And restrict the number of images so the script runs quicker, too. Pre-size the png's to the size you need, like 90px x 90px, so the Server doesn't have to re-size them. Irfanview is a free download and includes a Batch Convertor that will change your existing images to png and resize them at the same time. Highly recommended. And if you need this as a jpg or gif based script, let me know... I might even make a multi-format version... 
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : image, rotator, script, easy, implement
- [phpbb] Member Last-visit Report Script
for phpbb2 databases (0)
Background Image Swap Script
Change a Background Image based on clock time (15) Background Image Changer Script To swap the background image from your CSS file according to the
Server Clock Time. 1.) In your CSS file, add the following rule: CODE body { background:
url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the folder, place three images
named morning.png, day.png, night.png. 4.) Also, in the same folder, create an index.php file and
copy/paste the following script. CODE $hour = date('H'); if ($hour $image =
"morning.png"; } elseif ($hour $image = "day.png"; } else { $image = "night.pn....
For ... Next Loops And Script Planning
My Fifth PHP Tutorial (2) Be sure to read the other ones. They are located in the TUTORIALS section, and at the time of this
writing all on the first page. Intro To PHP Tutorial 5 - For ... Next Loops and Planning Scripts
Released 4/15/07 By Chris Feilbach aka GhostRider Contact Info: E-mail: assembler7@gmail.com AIM:
emptybinder78 Yahoo: drunkonmarshmellows Website: http://www.ghostrider.trap17.com Before I start
talking about what wonderful things loops are and all the cool stuff they can do, I want to address
something first. I was asked about something to write in PHP. There isn't....
Math Captcha Image Validation
(10) This tutorial will show you how to make a basic math CAPTCHA validtion form. This requires that you
have the GD library for PHP installed to work. This tutorial requires 2 files, login.php and
action.php. The first step is to create a sub-folder to store the temporary images, for the
purposes of this tutorial,this folder should be called images. Now upload a image in there called
verify.php and chmod just that image(not the folder) to 777 so that image can change as our
functions generate new images. Ok, after you've done that, we can get to the code: in login.p....
A Simple Php Captcha - Image Validation
(27) OK, I recently had the need to create a PHP CAPTCHA system for a friend, and I am sharing this as a
tutorial with the good people here at Trap17. I am sure you have all seen a CAPTCHA before (although
you may not have known what it was called). They are the little codes you often have to enter when
you register with a site, to make sure you are a person and not an automated script. Some common
examples look something like this: My system doesn't really do anything as fancy, but I
think that it is slightly more readable that some of those that get generated. Every....
Image Gallery Tutorial Using Hoverbox
A php solution to coding the Hoverbox Image Gallery (15) As reported in another posting , there is an Image Gallery named Hoverbox from the Sonspring site
which is a pretty cool display method using CSS to have Thumbnail pictures double their size by
hovering over them. I liked the css included in the original Tutorial as found on the Sonspring
site , but I knew there was more than one use for the Hoverbox and took it upon myself to explore
the use of the Hoverbox on a site I webmaster. One thing that wasn't right was having to
hardcode the image tags, so the first version I wrote used php to fill the Hoverbox by rea....
How To Make Image To Highlight When It`s Mouseovered
(9) Place this code between and tags. CODE function makevisible(cur,which){
strength=(which==0)? 1 : 0.2 if (cur.style.MozOpacity) cur.style.MozOpacity=strength else if
(cur.filters) cur.filters.alpha.opacity=strength*100 } // --> Place the following code within
all of the image tags you'd like the effect to be applied. CODE
style="filter:alpha(opacity=20);-moz-opacity:0.2" onMouseover="makevisible(this,0)"
onMouseout="makevisible(this,1)" And your image tag might look like that. CODE
"yourimage.gif" in last code change to your ....
How To: Ip Configuration Script (win Xp)
If you travel a lot with your laptop, and need to switch between diff (0) How To: IP Configuration Script (win XP) If you travel a lot with your laptop, and need to switch
between different IP's in different locations, this script is for you. There are many programs
that handle this task very well, but they cost sometimes pretty big money. This tutorial will show
you how to make your own IP Configuration Script for free. This script is for a static ip address
configuration and is based on a little program called "NETSH.EXE" which is supplied with Windows.
How it works. QUOTE Microsoft Windows XP - Using Netsh Netsh.exe is a....
Php Script To Make A Link List
From the list of the Directory Files (6) Well, it has been a while since I have added anything to the Tutorial Sectiion, so here is another
script for the members to enjoy. This one creates a list of links from the contents of the directory
which it is run from. For instance, if you run it from the public_html folder, then all the files
(not the Directores) are listed and linked so when you click on the link, that file is parsed and
output to the browser. Here is the code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
An XHTML 1.0 Strict Page to List the files in this directory ....
Image Shack Mod
For Invision Power Board (2) Image Shack Mod For Invision Power Board ''These instructions will help you to install
'ImageShack on your Site' into the reply, quick-reply, and post-new-thread sections of your
Invision Power Board, thus giving your visitors the ability to upload images directly. After upload,
they may paste the images directly into their post box.'' CODE These instructions will
help you to install 'ImageShack on your Site' into the reply, quick-reply, and
post-new-thread sections of your Invision Power Board, thus giving your visitors the ability ....
Creating A Simple Image Viewer
Using Visual Basic 2005 Express Edition (4) I downloaded Microsoft's Visual Studio Express suite a few months ago, but only recently got
around to installing it. I have been practising with Visual Basic and making some rather basic
programs and utilities, but they contain most of the basic concepts. This tutorial will explain how
to create a basic image viewer, and I will try to explain each step from beginning to end as clear
as I can. To start you will need: Microsoft Visual Studio About 10-20 minutes free time OK,
first open up the Visual Basic part of the Studio. I am using the 2005 Express version, so....
Php Menu Bulding Script And Site Template
available for download (0) A Php Menu-builder Tutorial This Sidebar Menu-builder code and the php scripts are adapted from
a Tutorial on the Astahost.com Forum titled : CMS101 - Content Management System Design .
Since the original tutorial's author (vujsa) did such a marvellous job of describing the system
in the original Topic posting, I will not attempt to explain it here, rather, I invite you to have a
look at his Topic and learn from it. The Basic tutorial provided coding for developing a table-based
web-site template which used php includes and embedded data to create a &....
Script To Build A List Of Links
from filenames and h3 tags (2) Another Unordered List Script If you remember this Script , that tutorial was about creating
an un-ordered list of links from a list of files contained in a Folder which was specifically named
in the script. This current Tutorial goes several steps beyond that first Tutorial by being able to
create a list from several folder names and, more importantly, the script reads the list of links
from a 'flat file' rather than depending on the name of the folder to be hard coded in the
script. It is only one small step to have the folder names found in a mysql ....
Page Generation Time Script
A script to tell how long it took to generate (17) this is a script used to tell you or visitors how fast your page was generated for the person who is
viewing it... Ok it is verry simple!! all you have to do is put this script on every page... that
you want it to be on CODE $starttime = explode(' ', microtime()); $starttime =
$starttime + $starttime ; ?> and put it before everything on the page, for me i put it right
underneith the DOCTYPE script which i think is a bloody waste of space to have it on there, but
anyways.. i put it right below that and it works fine!! now where you want the time it....
Verifying Email Addresses
Using a simple PHP script (9) This simple script will allow you to run some basic checks to make sure that any email address
entered is actually an email address. There is no guarantee offered that this will stop every single
fake email address, but it'll provide some protection. Now, the code! First we need to get the
email address to verify. Here, I get it using POST from an HTML form. CODE //Load email
address from web form $email = $_POST ; Now, we move on to our first check. Does the text that
has been entered look like it could be an email address? This check can be performed....
Installing Ndstats!
The greatest Stats script of all time. (4) An example of this script cna be found at http://www.own.tc/ (click enter) This is by far the
BEST stats script and most sites use it! This is a PHP script and requires you to include files
(Please... don't do iframes!) DOWNLOAD LINK: GO TO www.ZYMIC.com and go to Php scripts>stats
scripts> and the current version of NDSTATS. Downlaod it and unzip it! Go to your WWW directory and
create a folder called "ndstats". Then what you need to do is upload all of your files into that
folder. You all should know how to do that. Then go to the top of the page(s) you wan....
How To Stop Image Hot Linking
for a selected directory. (17) Those of you that don't know what is meant by 'hotlinking', it is when someone directly
links to an image on your site so it will display on their site. This is what is called
'bandwidth theft' and being as accounts here have a limit on bandwidth, your bandwidth limit
could be exceeded by someone else hotlinking to your images. As most users of cPanel will know,
there is an option to disable hotlinking of images in the "Site Management Tools" section.
However, this disables hotlinking to all directories, what if you only want to disable hotlinki....
Yet Another Signature Rotator
(Easier, and more Efficient) (7) Hey Trap, It's Mr. Panda, and I'm introducing a signature rotator script I came across
several months ago. Unlike most other signature rotators on trap17, this one does DOES NOT
require the configuration process, and a new signature can be added, simply by uploading it to the
proper directory. Seeing as this requires so much less configuration, I do hope it will be
implemented by some of you 'Sig Masters' out there /biggrin.gif' border='0'
style='vertical-align:middle' alt='biggrin.gif' /> , that have to add another line of code to your
rotator file....
Random Quote Script
(6) Here's a little random quote script that you can use to randomly choose from an array of quotes
you provide. It's very easy to use on any page as it's an external script, you just call it
from your page. I wouldn't use it for any more than about 50 quotes though, it would probably
slow your site down too much. Here's the code: var ar = new Array(44) ar = "Do not meddle in
the affairs of wizards, for they are subtle and quick to anger." ar = "Faithless is he that says
farewell when the road darkens." ar = "I cordially dislike allegory in all its ....
Image Rollovers In Javascript
A Write-Once, Use-Anywhere Approach (11) Tutorial: Image Rollovers w/ Javascript, by Rob J. Secord, B.Sc. (SystemWisdom) See a
working Sample of this Script! Download a ZIP containing all working files in this tutorial!
Note: If you are not interested in reading this entire tutorial and/or have a basic understanding of
the underlying concepts, you may safely skip to the Implementation section to get the code!
Description : A Dynamic Image Rollover Script tested to work in 4 major internet browsers: MSIE,
FireFox, Netscape and Opera. Using only Javascript combined with regular HTML Images ( ....
How To Use Trap17 Cgi Formmail
a built-in script in every hosting (15) This tutorial is using TRAP17 hosting's built-in script called cgiemail. There are several
hundreds of free scripts you can download and install it yourself but why not use what is already
provided for you, if all you need is a simple submit and data collection? Let's begin. There
are three things you need to remember: 1) you can rename the file however you'd like 2) two
files (which I'll name them submitForm.html and template.txt ) must be in the same directory
3) first two lines in template.txt must EXIST. Write your submitForm.html (where you ....
[php] Simple Newsletter Script
(17) This tutorial will give you the code needed and tell you how to implement it. First off you need to
create a file called mailing.php this will be the file that processes the adding of emails to the
list. CODE $email = $_POST ; $file = fopen("mailing.txt", "a"); fwrite($file, "\n" . $email);
fclose($file); header("Location: mailing_thankyou.php"); ?> Next you need to create a file
called mailing_thankyou.php , simple a page thanking them for signing up. Now create a file called
mailing.txt with nothing in it, when uploaded to the server set it writable (c....
How To Make A Sig Rotator
for people with multiple sigs (85) Today, I will show you how to make a sig rotator similar to mine (refresh a page with my post, and
you will see a different sig each time). We will use the sig rotator to display random sigs here at
trap17. Create a folder called sig.png Actually, the folder can be called anything, but since we
will be using the rotator here, it has to be called sig.png because Invision Power Board may not
allow weird extensions. You can replace png in sig.png with any valid image extensions such as gif
of jpg. Create a file called index.php If you need help renaming a file to .....
How To: Change An Image When A User Clicks On It
using both php and javascript (12) How To: Change An Image When A User Clicks On It using both php and javascript - a powerful
combination I have seen quite a few how tos offering a method of doing this but none of which
resembled my method of making use of both php and javascript. This code is fairly repetitive and
most of the functions are easy to pick-up if you haven't heard of them before. Here it is...
Create your two images. Call them anything you like, you'd just need to change their filenames
in $imgano $imgayes. In fact with this script you can easily create more than one pair....
Secure The Email Addresses On Your Website!
Wonderful script and useful! And working (10) Just follow the instructions below: /* Secure Email Function by Juan Karlo Aquino de
Guzman Website: http://www.karlo.ph.tc and http://www.abs-cbn.ph.tc E-mail:
http://www.karlo.ph.tc/send.php Usage: showEmail("support@microsoft.com",0); OR
showEmail("support@microsoft.com",1); Types: 0 = ordinary random 1 = more secure random To
include to a script: include_once("email_secure.php"); */ And here is the code :
CODE /* Secure Email Function by Juan Karlo Aquino de Guzman Website:
http://www.karlo.ph.tc and http://....
E-mail Mailer Script 0.1
useful for website visitors (4) Are you pissed off when you are putting e-mail in your website, you always get spammers? Well,
here's the solution. Just change the default variables to anything that you like, etc... follow
the instructions on the script.. Here it is... hope you like it /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> CODE //E-mail Mailer Script 0.1 by Juan
Karlo de Guzman //FOR TRAP17 ONLY... DEMO VERSION... DO NOT DISTRIBUTE header("Content-type:
text/html; CHARSET=UTF-8"); $int_rand=mt_rand(1,20); if($int_rand>10) {
$random_numbers=sha1(mt_ra....
Image Preloader With Progress Bar Status
Pure Client-Side JavaScript tested in 4 Browsers! (28) Tutorial: Image Preloader with Progress Bar, by Rob J. Secord, B.Sc. (SystemWisdom)
Description : A Tutorial for a Client-Side Image Preloader with Dynamic Real-Time Progress Bar
Indicator written in JavaScript! Tested to work with 4 Major Internet Browsers: Firefox, MSIE,
Netscape, Opera (Complete sample solution provided at end of tutorial, just put it on your
web-server, add your images and go!) Intended Audience : Beginner to Intermediate Web
Developers. Although this tutorial will cover some advanced aspects of JavaScript, I will try to
explain it all ....
Email Script/form With Php
how to make a simple email script using php (37) Today, I'm going to show you how to make an email script using PHP and HTML. Most people usually
put Email me if they want an email link on their site, but there are several cons to this.
First, it's very inconvenient for those people who use web-based mail such as Yahoo!, Hotmail,
or Gmail because that darn Micro$oft Outlook program comes up if one accidently click the link.
Second, you are very suseptible to spam bots because they scan your HTML source code for anything
with the same pattern as an email address and add it to their database. If you are pre....
Php Quiz Script
Make quizzes for your site. (29) Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
doesnt do anything special but I am going to make an email mod for it so that it will email results
to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
editor and paste in the following code. CODE $qid = "Quiz ID-00"; ?>
Username: 1.) Question number one is? Answer1 Answer2 2.) Question number two is?
Answer1 Answer2 3.) Question number three is? Answer1 Answer2 4.) Question num....
A Little Introduction To 3d Studio Max
How to make a simple abstract image (11) This tutorial will teach you the basics of making abstract images in 3D studio max. In this example,
I used a simple sphere, and applied the “Noise” modifier. Then, I applied a transparent, blue,
plastic-like material to spice up the whole thing. Let’s start. First, make a sphere by selecting
the “Sphere” button in the “Standard Primitives” section, and draw somewhere in the center of the
perspective view. We will set the size of the sphere later on. The sphere I made looks like this,
yours can be different in size and color, but the only thing that is important is to....
Looking for image, rotator, script, easy, implement
|
Searching Video's for image, rotator, script, easy, implement
See Also,
|
advertisement
|
|