Jump to content

[SOLVED] php random gif help please


LiLCruz

Recommended Posts

Hi I'm new to php and would like to know how does Aeon  on this forum http://forums.narutofan.com/showthread.php?p=19712997 change his gifs when you reload the page i ask him but he gave me no response i guess he didn't want to tell me  :'(.can someone please tell how i do this because i want to do the same thing.i think he has he's gifs hosted on his website. ??? i saw php end of the gifs so i came here.

Link to comment
Share on other sites

Depends on how dynamic you want it to be.  But here's the pseudo. 

 

1) Have a folder with 3 images, "image1", "image2", and "image3".

2) Assign a variable $image_num with a random number (1, 2, or 3).

3) When you load the image it should look something like:

 


Link to comment
Share on other sites

do i have to host the folder somewhere sorry being a nub

 

Where are the images going to live?  It's OK, we all start somewhere.

 

btw i don't have a website do i have make one do this?

 

Yeah...  How will your code get executed and rendered without one?

Link to comment
Share on other sites

the php code is easy, as all it does is load up the image file and send the output.

if ya have yer images as say, sig_1.gif,sig_2.gif,sig_3.gif,sig_4.gif.....

we can make it really simple

<?php
header('Content-type: image/gif');
readfile("sig_". rand(1,4) .".gif");
?>

 

however this wont work in most img tags as they check the extension, ya can either use path_info or htaccess rewrite to work around it :)

Link to comment
Share on other sites

thanks for the replies ok made the website but i don't see nothing on php but i see stuff to install like

PHP-Fusion

PHP-Nuke

phpBB2

phpBB3

 

which one do i install?

 

and on File Manager a made a folder and put the gifs after that I'm lost i think im doing something wrong.

Link to comment
Share on other sites

thanks for the replies ok made the website but i don't see nothing on php but i see stuff to install like   

  PHP-Fusion

  PHP-Nuke

  phpBB2

  phpBB3

 

which one do i install?

 

To answer your question, whichever you want/like.  Why are you asking about forums when you don't even know how to start a website? 

 

and on File Manager a made a folder and put the gifs after that I'm lost i think im doing something wrong.

 

Well what are you doing?  Do you have any code?  What's the problem?

 

 

Link to comment
Share on other sites

thanks for the replies ok made the website but i don't see nothing on php but i see stuff to install like   

  PHP-Fusion

  PHP-Nuke

  phpBB2

  phpBB3

 

which one do i install?

 

To answer your question, whichever you want/like.  Why are you asking about forums when you don't even know how to start a website? 

 

and on File Manager a made a folder and put the gifs after that I'm lost i think im doing something wrong.

 

Well what are you doing?  Do you have any code?  What's the problem?

nope don't have code yet problem is don't know where put the code  :'(. sorry about that forums thing did not know what those are.

Link to comment
Share on other sites

Wut was giving by everybody is how to make a dybamic image (if its yer website).

the code I posted with lil modifcation is how to make a dynamic sig image (if its on a forum ya want to use it on)

 

since Aeon was able to post a php file as an image

ya use the script i gave ya, yer image host (free webserver, no ads).

and use something like [img]http://www.mywebserver.com/mysig.php[/img]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.