Random logo in header.

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   re: Random logo in header.
echo
CZ Wiz
 Codezwiz Site Donator
echo has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Oct 04, 2003
0.15 posts per day
Posts: 1147
Points: 93
   
Can I use that Image.php file in a block? I have several photos I would like to have appear at random on my site in a center block or in the Messages Administration area , is this possible or am I brain dead again today? Thx,
echo



Back to top Reply with quote
#2   re: Random logo in header.
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
Kelly_Hero has been a member for over 20 year's 20 Year Member
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.50 posts per day
Posts: 3765
Points: 351,412
   
I don't see why not...I use it anywhere on a page I need to call in some random images...all that you would put in the block would be the code for the php include...it would use image.php to call the images you want displayed in the block. Give it a try and see.

Kelly



Back to top Reply with quote
#3   re: Random logo in header.
echo
CZ Wiz
 Codezwiz Site Donator
echo has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Oct 04, 2003
0.15 posts per day
Posts: 1147
Points: 93
   
Thank you Kelly, Would you mind showing me in this included code where and what I need to edit? and does this file just get uploaded to the root directory? Thank you,
echo

<?php
/*
-------------------------------------------------------------
|MD Random Image Generator                                  |
|Version 1.0.0                                              |
|This program is Copyright (c) Matthew Dingley 2003         |
|For more help or assistance go to MD Web at:               |
|www.matthewdingley.co.uk                                   |
|For information on how to install or for basic licence     |
|information, view below                                    |
|                                                           |
|This program is not to be used on a commercial site without|
|a commercial licence. Go to [ Register or login to view links on this board. ] for   |
|more information.                                          |
|                                                           |
|To install, just enter in the directory name that you store|
|the images in to the variable below named $dir. Upload any |
|images to that folder to have them randomly displayed.     |
|                                                           |
|You can also edit the variable $pattern if you know what   |
|you are doing.                                             |
|                                                           |
|To display the random image on your web page, you can      |
|either copy and paste all of this code into the page where |
|you want it or you can include it by putting in the        |
|following code into the page where you want the image:     |
|<?php include "image.php"; ?>                              |
-------------------------------------------------------------
*/
$dir=opendir("/home/you/public_html/folder/");
//This is the directory route to the folder
$directory="";
//This is a relative link to the directory if it is not in the same directory as the file you are displaying the images on

$pattern="\.(gif|jpg|jpeg|png|bmp|swf)$";
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]");
echo "<br><img src=\"$directory$image[$randNum]\" $size[3]>";
?>



Back to top Reply with quote
#4   re: Random logo in header.
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
Kelly_Hero has been a member for over 20 year's 20 Year Member
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.50 posts per day
Posts: 3765
Points: 351,412
   
$dir=opendir("/home/you/public_html/folder/");
//This is the directory route to the folder
$directory="";
//This is a relative link to the directory if it is not in the same directory as the file you are displaying the images on


Kelly


Back to top Reply with quote
#5   re: Random logo in header.
echo
CZ Wiz
 Codezwiz Site Donator
echo has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Oct 04, 2003
0.15 posts per day
Posts: 1147
Points: 93
   
My brain has many dead cells it appears icon_cry.gif Lol, I fixed it by a simple install of the "Random Pic" block...right in front of my face icon_mrgreen.gif



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum