Astahost.com   Mar 21, 2010
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Random Image / Random Header - S.O.S.

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Random Image / Random Header - S.O.S.

friso
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

Comment/Reply (w/o sign-up)

mastercomputers
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

 

 

 


Comment/Reply (w/o sign-up)

ChronicLoser
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

Comment/Reply (w/o sign-up)

marijnnn
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

Comment/Reply (w/o sign-up)

k22
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);
?>

Comment/Reply (w/o sign-up)

cryptwizard
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.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : random, image, random, header, s, o, s

  1. Php Random Selector
    whats the code (2)
  2. Dynamic Php Image And Better Php Code Question
    (10)
    Im working on a dynamic image, can i put 2 images in same dynamic image, and can i make this code
    shorter? if ( $goal == 31 ) { $xp2 = ('14833'); } elseif ( $goal == 32 ) { $xp2 =
    ('16456'); } elseif ( $goal == 33 ) { $xp2 = ('18247'); } elseif ( $goal == 34 ) {
    $xp2 = ('20224'); } elseif ( $goal == 35 ) { $xp2 = ('22406'); } elseif ( $goal ==
    36 ) { $xp2 = ('24815'); } elseif ( $goal == 37 ) { $xp2 = ('27473'); } elseif (
    $goal == 38 ) { $xp2 = ('30408'); } elseif ( $goal == 39 ) { $xp2 = ('33648')....
  3. Dynamic Gd Image
    (2)
    I dont know if someone already made a topic like this, however it's not hard to understand if
    you can php, as many know we need to start a php script with CODE and end with CODE ?>
    to make a image you need a image type, I choos .png because its much cleaner then .jpg CODE
    header("Content-type: image/png"); for the background for the image we need this code CODE
    $image = imagecreatefrompng("http://www.imagefilez.com/out.php/i252132_Userbar.png"); if we wont
    a text in the image we need a font color, we get our font color from HEX values ....
  4. Random With Functions?
    (4)
    Hey! Is it possible to use a random script on functions. Lets say I have created three functions
    (Items that a user will win if he defeates a monster). One function is a function named shield()
    and another function is named sword() and a third function is named helmet(). Now when a player
    defeates a monster, he must be awarded. So.. How can I randomize what item he should get? something
    like CODE rand(sheild(), sword(), helmet()); or? Thanks //Feelay....
  5. Image Popup On Mouseover
    (23)
    I need a script that does this: Lets say I have form with options...you surely know what that is...
    CODE Who do you wanna race?           Derbi Senda 50      Honda NS 50 R      Suzuki ZR
    50      Yamaha DT 50 MX      Aprilia RS 50      - ?         When i put my mouse over
    one of them i want a picture of bike on which your mouse is on to pop up... I hope you understand
    what i mean...i can't rephrase it to be more meaningful...i tried /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />....
  6. Need Help With Background Image...
    (12)
    I want to add background image to all sites on my website but some include "foot.php" and "head.php"
    and some "footer.php" and "header.php" but all include "config.php" but i dont know in which should
    i put it....any help??....
  7. Help: Removing A Specific Header With cURL
    (0)
    Hi all, I' ve problem sending HTTP POST(multipart/form-data) request using CURL. The server
    always reply with HTTP/1.1 417 Expectation Failed . Then I review my code and the tcp packet using
    wireshark for long long time /sad.gif" style="vertical-align:middle" emoid=":(" border="0"
    alt="sad.gif" /> just to figure out where is the error!. This problem only for one site and for the
    others site my script works perfectly!. here is my packet that sent to the server CODE POST
    xxxxxxxx HTTP/1.1 Cookie: PHPSESSID=447c6f5c9e73c22a1bf50dd46940306e Host: www.xxxxxxxxxx....
  8. Random Name Generator
    For a fantasy RPG forum (2)
    Well, I did this particular piece of coding a few days back, and I forgot to display it to you all
    here at AstaHost. I have just started a fantasy RPG forum. The naming rules are pretty strict
    because it has to be based on a construted langage called Pasen. No matter how much I explained, I
    thought, it would be hard for a newbie to understand the syllable formation constraints. Hence, I
    wrote a script and put it at my Drupal powered site, that generates random names for the four races
    for both genders. http://www.WiseTome.com/name-generator-for-chaos-and-order I ....
  9. Php :: Image Pixel Per Inch And Conversion
    Please Guide (1)
    Hi Masters I want soemone to let me know (maybe through a good tutorial and/or PHP Sample Code)
    the following : 1 - User will only allowed to upload images with minimum 120 and maximum 300 Pixel
    Per Inches 2 - User will only allowed to upload JPG images, however, if Gif / BMB / PNG / ETC is
    uploaded the script will convert that into jpg. 3 - If the Image's PPI is > 300 it will set
    to 300. Please guide . I know this can'y be done by GD it requires ImageMagick, Pleae help
    !!!!!!! ....
  10. Image Works With Php And Gd
    (3)
    Hi I have a 1 Big map. What i want is that the user will enter the latitude and longitude. the
    script will show that location in the image. I know how to convert Image X,Y Coordinates into
    Latitide and Longitude and vise versa. But there point is that the image is 1000x1000 wide but i
    want to show only the particular region of that latitude / longitude in 300x300 image. means that
    the PHP script will CROP wht Image (1000x1000) to 300x300. That way, the script will be shoing the
    part of an image, not the whole image. please help !!....
  11. Php :: Adding Image Over Image
    (5)
    Hi Masters & Champions. I want some help regarding putting and image over some location (x pixel ,
    y pixel) of an image. Here it is quite important to note that the mage which is Inserted over an
    image must be clickable. Like for example suppose i put T on an image DD then the T must be
    clickable. Please gudie as this is quite important for me . Thanks ....
  12. Script For Viewing A Random Image Needed
    (3)
    While browsing the web, I bumped into a script that I could really use, since it's different
    from everything that I saw. Most scripts that view a random image contain a code that chooses an
    image, and then puts the part into the page itself. However, on the www.greenplastic.com web
    site (dedicated to Radiohead), in the top left corner there is a random image module. If you look at
    the code, here's what is used: CODE Now, how can a PHP script be an image, and what
    kind of script that is? If you do visit that URL , you don't get a normal page, b....
  13. How To Embed Ram File Produced By Http Header
    (2)
    Dear Friends I want to stream music from my website. The file format is .rm. People say that one
    need a Helix Server or other media server to stream. I have found a solution to this problem as
    well. I read an article about streaming music. It tells that if the size of the media file is small
    and the byte rate of the media file is lower than that of the user internet connections byte rate,
    the file get streamed automatically from HTTP server. In theory, any file is "streamed" by a web
    server that is, sent back to the client in small pieces. What makes media files speci....
  14. How Do I Resize An Image On The Fly?
    (8)
    I was wondering how I would go about resizing an image from a databse without saving it to a file.
    CODE include("settings.inc.php"); $get_a=$_GET ; $get_b=$_GET ; $get_width=$_GET ;
    $get_height=$_GET ; $query="SELECT * FROM $get_a WHERE id='$get_b'";
    $result=mysql_query($query); $image=mysql_result($result,0,"coverimg");
    $size=mysql_result($result,0,"imagesize"); $type=mysql_result($result,0,"imagetype");
    header("Content-length: $size"); header("Content-type: $type"); echo $image; ?> Obviously the
    image I want to resize is $image. The page name....
  15. Uploading Image Via Admin Menu?
    (2)
    There's never much action in here. Here's a question for all you php guys out there.
    Here's what I want. Let's say I create a simple administration menu for someone to
    Add/Edit/Delete a record/item from a database. Now in the add function, let's say I want to
    store a URL to a image. Rather than having to go in and FTP that image up on the server, how could
    a person create a 'Browse' button and find that image on your harddrive, then create a
    script to upload the image to the server? Just wondering how to do it, or if it could be done e....
  16. How Do I Make PHP Based Image Gallery Like This?
    Help Needed (20)
    is it possible to make a page in php, with a url like this:
    httq://www.mysite.com/viewer.php?http://www.mysite.com/galleries/01 (This is a sample link, read
    below) so that in what i change the last part the gallery will change with it? so that i just have
    to make one php-page and this page just shows all the imaes in the map thats in the url after the
    questionmark?? thanks,....
  17. Saving A Php Generated Image To The Server
    Help Needed Please (5)
    I'm trying to create a script that will generate an image and send it back to the browser while
    saving the same image to the server. I'm doing this because the image should be dynamically
    generated but because of the load that would place on a server if the image happened to be requested
    frequently, I've decided to build in a means to serve the static version of the image most of
    the time. What isn't included here is the function that will check the age of the file in cache
    directory and serve the static image if it is less than an hour old. This isn....
  18. Is It Possible To Create A String Image In Chinese
    (0)
    CODE Using imageloadfont $im = imagecreate(50, 20); $black = imagecolorallocate($im, 0, 0, 0);
    $white = imagecolorallocate($im, 255, 255, 255); imagefilledrectangle($im, 0, 0, 49, 19, $white);
    $font = imageloadfont("04b.gdf"); imagestring($im, $font, 0, 0, "Hello", $black); imagepng($im); ?>
      This is an example for illustrating how to create a image including a string with a specific
    font. In the codes, a font named "04b.gdf" is loaded and the string is created according to the
    font. What is the font named gdf? I mean what's the limitation or specificatio....
  19. Php: Write Random Text As Image
    Having problems, help needed! (3)
    I'm trying to create a script that writes text to an image. CODE header("Content-type:
    image/png"); $_phrases = array( "Test 1", "Test 2", "Test 3", "Test 4", "etc." );
    $_rand_phrase = $_phrases ; $_image = imagecreatefrompng("gmail.png"); $_user_width =
    imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value = (200-($user_width + 113)); $_color =
    imagecolorallocate($_image, 165, 164, 164); imagettftext($_image, 9, 0, $_x_value, 16, $_color,
    "tahoma.ttf", $_rand_phrase); imagepng($_image); imagedestroy($_image); I can't see what
    I'm doing w....
  20. Forum Signature-image With Php
    Use PHP to create an image in real-time (8)
    With interest I have read these Topics. What I want to do with PHP is the following:
    Signatue-image This is the Forum Signature of my cousin, who lives in Europe. The image is
    generated in real-time. (Refresh the page, and see for yourself) My cousin refuses to tell me how
    he did this. But I want to do the same thing, also with PHP. Any ideas? Greetings, John.
    Notice from microscopic^earthling: This is NOT a tutorial and in future you
    should be more careful about where you're posting your threads. Moved to Programming > Script....
  21. Php Random Text Generating
    How to Generate Random Text (11)
    I was trying to figure out how to make random texts for random passwords and stuff, and I found
    someone who created this code. QUOTE //author: polmme $codelenght = 10;
    while($newcode_length $x=1; $y=3; $part = rand($x,$y); if($part==1){$a=48;$b=57;}  // Numbers
    if($part==2){$a=65;$b=90;}  // UpperCase if($part==3){$a=97;$b=122;} // LowerCase
    $code_part=chr(rand($a,$b)); $newcode_length = $newcode_length + 1; $newcode = $newcode.$code_part;
    } echo $newcode; ?> I think it's pretty good. If anyone has a better one or suggestions,
    please tell me.....
  22. Random Banners Rotation...
    set by percentages (2)
    alright, I know a few different ways to make a random banner with php - where a different banner
    would rotate with every refresh/click. But I've had some "customers" complain how they think
    their banner should show up more then others for one reason or another, and I completely agree with
    them. So now I kinda want to have a code (most perferably php or javascript) that would have the
    banner rotation where I could set a peticular banner to show up say 15% of the time and another 5%
    so I could satisfy my more loyal members over the ones simply looking for more hits to ....

    1. Looking for random, image, random, header, s, o, s



See Also,

*SIMILAR VIDEOS*
Searching Video's for random, image, random, header, s, o, s
advertisement




Random Image / Random Header - S.O.S.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com



Creative Commons License