Hi i am using the script below to save an image FROM another domain into my own domain.
//get image name and extension
$img = 'http://otherdomain.com/image/123.jpg';
$getname = explode('/', $img);
$thumbname = $getname[count($getname) - 1];
//save the image file
$file = file_get_contents($img);
$path = 'thumbs/'+ $thumbname;
file_put_contents($path, $file);
But i cant get this to work. the $path resulted in 123
but not 123.jpg
(which i need).
and am i doing the file get content and file put content right?