generate functionThu, 15 Dec 2022

get image from url, save it to disk and return a full url of the image

function getImage($url, $fileName) { $dir = 'images/'; $filename = $dir . $fileName; file_put_contents($filename, file_get_contents($url)); return $filename; } getImage('http://example.com/image.jpg', 'image.jpg');

Questions about programming?Chat with your personal AI assistant