GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 19,070

0 members and 19,070 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jun 2005
    Location
    USA
    Posts
    43

    Default

    this isn't really a tutorial, but I couldn't find out a place to post it. So here it goes. I originally wrote this script in Javascript, but than my friend later ported it to PHP and I just kept it. Made some minor changes to it though.

    Code:
    <?php
    
     $gen = rand(1,5); //change last number to number of images you have
     print("<img src="dir/to/imgs/splash$gen.jpg">");
    
    ?>
    okay, um place this script within the body tags of your layout. Change "dir/to/imgs" to the directory that houses your image. Re-name all your images to splash1.jpg, splash2.jpg, splash3.jpg, etc. All the way up to the last number you put in "rand(1,5)".

    I have tried this script and it seems to work just fine. Just reply if you encounter a problem.

  2. #2
    Join Date
    Jan 2005
    Location
    UK
    Posts
    615

    Default

    Thanks for this, im gonna be starting to learn php soon. Will come in handy.

  3. #3
    Join Date
    Jun 2005
    Location
    USA
    Posts
    43

    Default

    no problem. happy to help, thats what coders are for :P

  4. #4
    Join Date
    May 2005
    Location
    ☆ 127.0.0.1
    Posts
    863

    Default

    Does it work here? I know I've tried a CGI script for this and it told me that it doesn't allow dynamic url or something along that line...

  5. #5
    Join Date
    Jun 2005
    Location
    USA
    Posts
    43

    Default

    Originally posted by Psypher@Jun 21 2005, 08:06 PM
    Does it work here?* I know I've tried a CGI script for this and it told me that it doesn't allow dynamic url or something along that line...
    [snapback]67598[/snapback]
    yes, it works. Im not too fond of CGI, so I dont know what could have gone wrong. I've used this script numerous times before, and it works just fine.

  6. #6
    Join Date
    Apr 2005
    Location
    Prague, Czech Republic
    Posts
    3,101

    Default

    and where should i write in code, where i wanna show the picture?


  7. #7
    Join Date
    Jun 2005
    Posts
    5

    Default

    Code:
     print("<img src="dir/to/imgs/splash$gen.jpg">");
    wont work... must be like:
    Code:
     print("<img src=\"dir/to/imgs/splash$gen.jpg\">");

  8. #8
    Join Date
    Jun 2005
    Location
    USA
    Posts
    43

    Default

    Originally posted by TyR@Jun 22 2005, 01:36 PM
    Code:
     print("<img src="dir/to/imgs/splash$gen.jpg">");
    wont work... must be like:
    Code:
     print("<img src=\"dir/to/imgs/splash$gen.jpg\">");

    [snapback]67895[/snapback]
    forgot about that... but catching mistakes is the fun part of programming though.

  9. #9
    Join Date
    Jun 2005
    Posts
    66

    Default

    no thank u i just barely learned ps

  10. #10
    Join Date
    Jun 2005
    Location
    USA
    Posts
    43

    Default

    Originally posted by dakid@Jun 22 2005, 05:51 PM
    no thank u i just barely learned ps
    [snapback]68016[/snapback]
    oh lol... PHP isn't hard to learn, of course my first language was C++...

Similar Threads

  1. Image Generator
    By Wade in forum Other Tutorials
    Replies: 7
    Last Post: 09-04-2006, 09:56 PM
  2. terrain generator
    By nosferatu in forum Digital Art
    Replies: 2
    Last Post: 12-15-2005, 01:34 PM
  3. Random Link Generator
    By NightStalker in forum Other Tutorials
    Replies: 4
    Last Post: 09-24-2005, 07:13 AM
  4. Error Message Generator
    By the_dude_of_darkness in forum The Void
    Replies: 8
    Last Post: 06-18-2005, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1