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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Absolute path of remote images

    I'm building a site for a client that has a feature similar to the way Facebook grabs images from a url you enter (ajax?). I've tried for days and I can't seem to find a simple way to get absolute image paths from a remote url. I can get the relative ones just fine, though.

    Any thoughts? This is driving me nuts.

  • #2
    Regular Coder
    Join Date
    Jan 2010
    Posts
    101
    Thanks
    17
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by bluemoonballoon View Post
    I'm building a site for a client that has a feature similar to the way Facebook grabs images from a url you enter (ajax?). I've tried for days and I can't seem to find a simple way to get absolute image paths from a remote url. I can get the relative ones just fine, though.

    Any thoughts? This is driving me nuts.
    Get the address from the user inputed URL (such as http://google.com) and append the relative image path (images/image.gif):
    Code:
    $url = $_GET['url'];
    $image_path = "images/image.gif";
    if(file_get_contents($url)){
         $url += $image_path;
    }
    There's probably better ways of doing it, and of course you'd have to check to make sure there are no variables and such attached to the url.

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That works fine unless you have an image path like this: "../../images/01.jpg"


  •  

    Posting Permissions

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