Results 1 to 7 of 7

Thread: Dynamic Image Countdown..

  1. #1
    Join Date
    Aug 2009
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Dynamic Image Countdown..

    How would I create a Dynamic Image with a countdown to an event on it??

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Can you fully explain the idea? I don't understand yet.

    You posted this in the PHP section-- do you want this to occur every time the page loads, or do you want this to be a moving part of the page? PHP can only work once, each time the page loads (or reloads). You will need to use Javascript if you want this "moving" without reloading the page.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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

    Default

    I'd like it so users on my site can take it and use it as a forum signature I don't know if JavaScript can do that..

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Typically forums will not allow Javascript, but they will certainly not allow PHP. Do you want to host something on your site (an image?) that can be loaded in a signature?
    Again, please fully explain what you want, perhaps with an example if you have one. What will happen and when...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Aug 2009
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Yes I want to host an image on my site which has a countdown to a specific date on it, an can be used as a signature...

    something like this.. http://i33.tinypic.com/11awrx0.jpg

    Is that better or should i get more examples?

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah, now I understand.

    What you will do is create an "image" that is actually a PHP file. This is a PHP file just like one that can generate HTML, but instead its output will be the image data.

    You will use an image functions library like gd or image magick. Either will be fine, though they both are very slow at times and hard to use. For a simple and small image like that, however, it will not be too difficult.

    What you will do is import an existing image, in that case the cat. Then you will use image_text() or a similar function to add text to the image, based on the current date. You can get this using the function date(), in any format you'd like.

    Finally, you will use a function like imagejpeg() to output the image directly.

    At the very beginning of your script, you must set the correct file format headers, so that the data is served as an image instead of text.

    There should be plenty of information available by searching for either "gd" or "image magick". php.net will have information for any of the specific functions.


    After that, all that they will need to do is add that link to their signature and it will automatically update whenever it's loaded.



    Additionally, this will mean that your "image" has a .php extension. If you must use a .jpg or other image extension, you must force this using .htaccess to process the ".jpg" extension as a PHP file. This is, however, a terrible idea for ALL of your images, so do this only in a local subdirectory.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    See also:

    http://us3.php.net/manual/en/function.imagepng.php

    Take note also of the wealth of image functions available with GD listed on the left side of the above page.

    With these you can take just about any existing image, and using the date and other more basic PHP functions, slap on to it any countdown you like.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •