Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2003
    Location
    Salto - SP - Brazil
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Random Images - More complex than it appears

    Hello!

    My problem is very simple... I don't know how this is made...

    http://cristiano.galdino.net/avatar.png

    For sure, you can say )... It's only an image... No! (If you are prompted to save the image, do this!) Refresh the page now... It's changes the image... PNG can't do this! It's PHP (One of the images, show the actual date/time - PHP, obvious!)

    Someone know how to do this effect? (Detail: The extension of the file, is .png, not .php, how was expected)

    Thank You!
    Last edited by Skuall; 04-18-2004 at 07:43 PM.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    3 tips:

    always search the manual : http://www.php.net/manual/en/ref.image.php
    always run a search on google or another searchengine (therer should be a few zilion links on "PHP Images"
    always use the searchfunction in this forum. There have been numerous threads about creating/manipulating image with PHP
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    png is an image file, like .jpg or .gif

    Below is a php code I use to change an image every 10 seconds. I have 6 images that display according to the seconds of the server. Another method is the random (rand) number function with php.


    PHP Code:
    <?php
        
        $n 
    date('s');

        
        if  (
    $n 10)  {
        echo 
    '<table><tr><td><img border="2" src="images/banner/01.jpg" 
        width="346" height="150" alt = "image 1 of 6"></td></tr></table>'

        } 
        
        elseif (
    $n 20 )  {
        echo 
    '<table><tr><td><img border="2" src="images/banner/02.jpg" 
        width="155" height="150" alt = "image 2 of 6"></td></tr></table>'
    ;
        }  

        elseif (
    $n 30 )  {
        echo 
    '<table><tr><td><img border="2" src="images/banner/03.jpg" 
        width="305" height="150" alt = "image 3 of 6"></td></tr></table>'
    ;
        }  

        elseif (
    $n 40 )  {
        echo 
    '<table><tr><td><img border="2" src="images/banner/04.jpg" 
        width="412" height="150" alt = "image 4 of 6"></td></tr></table>'
    ;
        }  

        elseif (
    $n 50 )  {
        echo 
    '<table><tr><td><img border="2" src="images/banner/05.jpg" 
        width="365" height="150" alt = "image 5 of 6"></td></tr></table>'
    ;
        }  

        else {
        echo 
    '<table><tr><td><img src="images/banner/canada.gif" 
        alt = "Canadian flag - 1967"></td></tr></table>'
    ;
        }

        
    ?>
    Leonard Whistler
    www.stubby.ca
    Last edited by Len Whistler; 04-18-2004 at 09:21 PM.
    Leonard Whistler

  • #4
    New Coder
    Join Date
    Nov 2003
    Location
    Salto - SP - Brazil
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Quote Originally Posted by raf
    3 tips:

    always search the manual : http://www.php.net/manual/en/ref.image.php
    always run a search on google or another searchengine (therer should be a few zilion links on "PHP Images"
    always use the searchfunction in this forum. There have been numerous threads about creating/manipulating image with PHP
    1 tip:

    Read carefully what someone just wrote...

    To create an image, with an file .php its easy, guy! But, my problem, is how to do this, with one file .png... understood?

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Skuall
    1 tip:

    Read carefully what someone just wrote...

    To create an image, with an file .php its easy, guy! But, my problem, is how to do this, with one file .png... understood?
    Hahahahahahahaaaah.

    Oh man. I suppose every now and then one of these needs to come along here .

    Anyway, if you'd bother to explain what you need, in a few understandable sentences instead of posting a link to an image, then maybe, just maybe, you could get better help.
    There are dozens of ways to dynamically create PNG's from text, gifs or whatever other content, and the page in the manual I linked to, even contains examplecode and all the info you need to do so. Dozens of others could be found within minutes with every searchengine.

    But i suppose i'm just to stupid to understand what extra-specials you need (or maybe , just maybe, your explanation could be clearer --> if you would just know what to ask for, that is).

    But don't worry ! Maybe someone who's better at mindreading, or that appreciates your style and attitude a bit more, or that is simply not as stupid as I am (it's genetic, sorry) will come along and spell it out for you.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #6
    New Coder
    Join Date
    Nov 2003
    Location
    Salto - SP - Brazil
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Quote Originally Posted by raf
    Hahahahahahahaaaah.

    Oh man. I suppose every now and then one of these needs to come along here .

    Anyway, if you'd bother to explain what you need, in a few understandable sentences instead of posting a link to an image, then maybe, just maybe, you could get better help.
    There are dozens of ways to dynamically create PNG's from text, gifs or whatever other content, and the page in the manual I linked to, even contains examplecode and all the info you need to do so. Dozens of others could be found within minutes with every searchengine.

    But i suppose i'm just to stupid to understand what extra-specials you need (or maybe , just maybe, your explanation could be clearer --> if you would just know what to ask for, that is).

    But don't worry ! Maybe someone who's better at mindreading, or that appreciates your style and attitude a bit more, or that is simply not as stupid as I am (it's genetic, sorry) will come along and spell it out for you.

    Well... "One image is better than thousand words"... Isn't true anymore?

    Sorry if you can't understand what I'm saying... If you didn't saw, I'm not English... I speak Portuguese... maybe this turn the things a little bit more hard to understand...

    MindReader? It's obvious what I want... How to generate random images, with a file like: "image.png". There are PHP on it... But how I mix then?

    I've send the exactly same message at phpfreaks forum and have response that I'm expected... Interpretation may vary...

    Thank you for helping me.
    Last edited by Skuall; 04-19-2004 at 12:29 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
    •