...

View Full Version : Absolute path of remote images



bluemoonballoon
02-24-2010, 12:42 AM
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.

iLochie
02-24-2010, 02:13 AM
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):


$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.

bluemoonballoon
02-24-2010, 03:25 AM
That works fine unless you have an image path like this: "../../images/01.jpg"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum