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 4 of 4

Thread: Refresh Image

  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts

    Refresh Image

    Hi, im not sure if you do this in Ajax or in php, im trying to make an image that refreshes like you see in some signatures, that update automaticlly.

    So if someone is using the image on a different website the image will still update even though they are not present on the hosted website for it to be updated.

    Is this possible?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Yes and no, it depends on what you're meaning.
    If its visual, and changes with time that passes, that is either a gif (or other animated image) or using ajax. PHP cannot refresh images - once processing is complete its job is done and cannot re-interact with an image.
    If you mean data (something like: 'this image has been viewed x times') that is done by using PHP to actually create the image (either from direct drawing techniques, or more often from an already existing image source), and when accessed it simply increments / changes its text, updates a database or file storage, and then serves the php page as an image.
    Note that most sites will require that an image based extension be used when using images. That assumes that they forum or cms or whatever isn't allowing direct html modification. The only way I know that can be used to handle that is to use htaccess and rewrite you're desired image extension to be served as php.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    No, im talking about a PHP script that creates the image as you explained but it stores that image on the server which can be linked to other websites/forums but the image created by the php script changes depending on certain variables. But i need it so that the image will update automatically, so if the image is used on a external site the image is still updated.

    Is this possible?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Then yes that can be done. The image itself is a PHP script, so it will always be attached to remotely. If its to be interpreted as an image, it can take care of any coding first and then display the image. Just remember what I said about most external sites requiring that you have an image based extension; this is pretty much a universal security enhancement, so you'll need to serve out images as php pages first and then as an image in case the file doesn't exist.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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