Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Random Image / Random Header, S.O.S.
friso
post Nov 24 2004, 06:18 PM
Post #1


Advanced Member
Group Icon

Group: Members
Posts: 142
Joined: 24-November 04
From: Netherlands
Member No.: 1,504


im building a website, and i need some help

i got 3 frames, navigation, top and main, but i want the top banner to have a new tagline with every refresh, just like the header, it dont really matter what coding it is, as long as it's not to weird tongue.gif
Go to the top of the page
 
+Quote Post
mastercomputers
post Dec 5 2004, 01:39 AM
Post #2


PESTICIDAL MANIAC
Group Icon

Group: Members
Posts: 630
Joined: 1-September 04
From: Auckland, New Zealand
Member No.: 27


QUOTE (friso @ Nov 25 2004, 07:18 AM)
im building a website, and i need some help

i got 3 frames, navigation, top and main, but i want the top banner to have a new tagline with every refresh, just like the header, it dont really matter what coding it is, as long as it's not to weird tongue.gif
*


I can help you out but I need to understand what you mean. What are you referencing when you say tagline and header. Are these logos, ads or text of some sort?

If you had a link to this site, or a screenshot with some editting of the areas you want to work on, that would be good to help understand.

There's many ways to achieve this, depending on the size of it, if it's only a few images then I would not use a database, but if there is quite a lot of images then I would use a database.

If it's a small size, what I would do is read the directory's contents, grab only image extensions or the images I want to use, count how many I've grabbed as this will be our maximum number, store it in an array, work on the random script noting our maximum value, have it point to an image and display that. There would be a few checks to make sure that errors will not occur or if major errors occur I would want an automated email to me, but since explaining security would mean going through a lot of can do and would do theories for better security you may need to pull up a chair and just think about all the possibilities.

Well get back to me on more of this and I will try to help you out.

Cheers,


MC
Go to the top of the page
 
+Quote Post
ChronicLoser
post Dec 5 2004, 06:36 AM
Post #3


Premium Member
Group Icon

Group: Members
Posts: 240
Joined: 13-November 04
From: Arizona
Member No.: 1,356


hmm....well, if you want to make a random picture show with PHP, i recommend using a sode somewhat like the one described on this tutorial: http://www.ethicsdesigns.com/random_images.php

i've used it before and it works well. Not too sure if this is what you're searching for though =P
Go to the top of the page
 
+Quote Post
marijnnn
post Dec 5 2004, 08:44 AM
Post #4


Premium Member
Group Icon

Group: [HOSTED]
Posts: 336
Joined: 22-September 04
Member No.: 798


if it's for banners, you can name them "banner1.gif", banner2.gif,...banner10.gif

and then in your page you put

<img src="banner<? echo random(0,10); ?>.gif">
or something alike. check out the random function at www.php.net/random
Go to the top of the page
 
+Quote Post
k22
post Dec 9 2004, 07:44 PM
Post #5


Advanced Member
Group Icon

Group: Members
Posts: 165
Joined: 22-September 04
From: IS - IT - US - BE
Member No.: 804


If you prefer a script to generate imgs with text inside or put a text on each img of yours site..
CODE
<?php
/************Random Signature V1,0******************/
/* CodeName: Randys v1.0;                         */
/* Coder: K22 - klakice[AT]swissinfo[DOT]org;                */
/* Date: 16-17/10/2004;                            */
/* License: GNU/GPL;                               */
/***************************************************/

/*******Config********/
/*Bar x dimension*/
$barx=600;
/*Bar y dimension*/
$bary=25;
/*Font type [1..5], Default 5*/
$font=5;

if(file_exists("frases.txt")){
$frases=fopen("frases.txt","r");
$x=0;
while (!feof($frases)) {
  $buffer[$x] = fgets($frases, 4096);
  $x++;
}
$val=rand(0,($x-1));
$code=$buffer[$val];
}
else $code="My programmer isn't very good, He does an error in my config :(";

$code=ereg_replace("\n","",$code);
$code=ereg_replace("\r","",$code);
$len=strlen($code);
$xpos=(($barx/10)-$len);
$xpos=$xpos*6+12;
header("Content-type: image/jpeg");
$image=imagecreatetruecolor($barx,$bary);
$text_color = imagecolorallocate($image, 0, 150, 255);
imagestring ($image, $font, $xpos, 4, $code, $text_color);
imagejpeg($image);
imagedestroy($image);
?>
Go to the top of the page
 
+Quote Post
cryptwizard
post Dec 12 2004, 04:16 AM
Post #6


Member - Active Contributor
Group Icon

Group: Members
Posts: 77
Joined: 11-December 04
Member No.: 1,704


I would like to help, but I don't really understand you.
If you want help quickly, it is suggested that you give as much information as you can.
The few seconds extra that you take to give information, could get your answer much quicker.
When I do that, I always give as much info as I can and I usally get something that works within the first 2 responses.
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   11 sendto 6,945 26th December 2008 - 12:59 PM
Last post by: iG-nwaynge
No New Posts   4 CiaraMarie 2,183 23rd December 2008 - 08:24 PM
Last post by: iG-Lucky
No new   26 iciclez 3,304 21st December 2008 - 10:30 AM
Last post by: Quatrux
No New Posts   15 rmdort 4,469 20th December 2008 - 05:38 AM
Last post by: laniczech
No New Posts   11 ViRuaL 2,360 10th December 2008 - 10:14 PM
Last post by: iG-nick
No New Posts   3 Sir Joe 2,025 2nd December 2008 - 03:14 AM
Last post by: iG-Ben and Hank
No New Posts 13 FirefoxRocks 465 24th November 2008 - 03:54 AM
Last post by: FirefoxRocks
No New Posts   7 eina 374 20th November 2008 - 11:30 PM
Last post by: tansqrx
No New Posts   10 TavoxPeru 785 6th November 2008 - 05:26 AM
Last post by: TavoxPeru
No New Posts   0 TavoxPeru 187 14th October 2008 - 05:18 AM
Last post by: TavoxPeru
No New Posts   1 suicide 1,385 12th October 2008 - 04:24 PM
Last post by: FirefoxRocks
No New Posts   6 pat23 5,161 30th September 2008 - 05:32 AM
Last post by: Jezstarr
No New Posts   2 soleimanian 4,809 7th August 2008 - 10:58 PM
Last post by: Guest
No New Posts   2 khalilov 315 25th July 2008 - 03:30 AM
Last post by: Mike gambino
No New Posts   6 tomtrak 3,032 13th July 2008 - 07:33 AM
Last post by: iGuest