Displaying different images for different IPs (4 posts)

  1. Jon W
    Posted 1 year ago #

    Is it possible to do this within a Post or Page, without making custom templates for each individual one?

    Ideally a way to wrap some code around that links to a maxmind type of database for the IP part.

    Needs to be simple, like me.


  2. Keith Driscoll
    Posted 1 year ago #

    Depends how you define simple :)

    It can surely be done with some PHP code http://us2.php.net/manual/en/book.geoip.php

    I don't know of a plugin :( but it sounds like you are looking for a way to serve geo based images.

  3. Scott
    Posted 1 year ago #

    I'm assuming you want to display something like a flag for each specific country?
    You can find info about how to do this here
    Real quick code to use in a page template (just one template should dynamically generate the correct flag code for each country), might look like:

    $ip = $_SERVER['REMOTE_ADDR'];
    <img src='http://api.hostip.info/flag.php?ip=<?php echo $ip; ?>' alt='IP Address Lookup' />
  4. Jon W
    Posted 1 year ago #

    Not sure if page templates will work for me. The image is within the body of the post.

    Will see if I can get php working in Pages and try the second option.

    Not flags, just pictures / photos that are specific to particular locations.

Topic Closed

This topic has been closed to new replies.

About this Topic