Advanced Search

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Turning DHTML into PHP???

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default Turning DHTML into PHP???

    You know, sometimes I feel like an idiot... choose one language to learn and its never the right one.

    I have a DHTML code that allows me to have "revolving" images show up in hourly time increments, say at noon one image is on the screen, and at 1 o'clock the image changes to another image.

    This is a very nice effect, a great bit of code, very similar to the one found here:

    http://www.dynamicdrive.com/dynamici...reqcontent.htm

    The problem is with the application I want to use this in, hiding the picture name is vital. Otherwise the player could bypass the time limit and just view the other picture needed to complete the puzzle.

    Is there a way to use php to have the same effect, and hide the picture names?
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hmm. Interesting question.

    I'll watch this thread for replies, and try to think of something myself.
    At the moment, the best I can do is a concept:

    - All the pages request the same "image", which will be a PHP file outputting an image.
    - The PHP file gets the time from the server and sends the correct image through.

    That way, all the filenames are the same, and it's the one PHP file that changes the image, not the image URL.

    Tell me what you think.
    cr3
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    A few things:
    1. It can't be completely PHP. However, you can use AJAX to help you along.
    2. How are you going to store this list of images?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It can be completely PHP. AJAX isn't necessary. The GD library (or an equivalent), however, is.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    It can be completely PHP. AJAX isn't necessary.
    Assuming the OP isn't trying to push new images onto the client, but even then AJAX isn't necessary.

    The GD library (or an equivalent), however, is.
    If the OP is just serving static images, the readfile function would be all that's necessary. Again, the OP hasn't specified.

    Mike

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by Mike
    Assuming the OP isn't trying to push new images onto the client, but even then AJAX isn't necessary.
    So why did you say that?
    If the OP is just serving static images, the readfile function would be all that's necessary. Again, the OP hasn't specified.
    Yes, of course. I'm sorry, I sort of jumped to dynamic imagery.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    Quote Originally Posted by Mike
    Assuming the OP isn't trying to push new images onto the client, but even then AJAX isn't necessary.
    So why did you say that?
    Well, if the OP does want to push images - that is, updating the image whilst the same page is displayed - then PHP cannot be used alone. However, AJAX doesn't need to be involved, just an assignment to the src property of the image.

    In order to force a new request to the same resource, a random query string value can be appended to the URL:

    Code:
    img.src = 'image.php?' + (new Date()).getTime();
    Mike

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    All those words and stuff above

    HEE. Sorry, see if this will explain better. I have 2 static pictures. I want one picture to show up on the page from noon to midnight (for example) and the second image to REPLACE the first from midnight til noon. At which time the first picture would then replace the second.

    This is for a game site, and it is important that the source code NOT give away the name of the pictures, or else the players could just put that name in the end of the URL, and view it. Also, I would prefer if it weren't known that there were multiple photos.

    Hence the pure php question.

    I am open to suggestions, hope this helps to clarify what I need.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    PHP Code:
    <?php
    header
    ("Content-Type: image/png");
    if(
    date('G') < 12$file "beforenoon.png";
    else 
    $file "aftermorning.png";
    readfile($file);
    ?>
    Thar y'go. Include the page in an HTML page just as you would any normal image.
    Quote Originally Posted by Mike
    However, AJAX doesn't need to be involved, just an assignment to the src property of the image.
    Ah, you were referring to the "completely PHP" bit, not the AJAX bit. Sorry, my misinterpretation.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Thank ye thank ye

    Now I just have to wait 12 hours to make sure it works right
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •