Saving An Image From Pc To Php

[Solved] Saving An Image From Pc To Php | Shell - Code Explorer | yomemimo.com
Question : saving an image from pc to php

Answered by : relieved-raccoon-fmpwekk3xyvd

<?php
$url =
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6-1.png';
$img = 'logo.png';
// Function to write image into file
file_put_contents($img, file_get_contents($url));
echo "File downloaded!"
?>

Source : https://www.geeksforgeeks.org/saving-an-image-from-url-in-php/ | Last Update : Fri, 28 Jan 22

Question : saving an image from pc to php

Answered by : relieved-raccoon-fmpwekk3xyvd

<?php
function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); return $data;
}
$data = file_get_contents_curl(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6-1.png');
$fp = 'logo-1.png';
file_put_contents( $fp, $data );
echo "File downloaded!"
?>

Source : https://www.geeksforgeeks.org/saving-an-image-from-url-in-php/ | Last Update : Fri, 28 Jan 22

Answers related to saving an image from pc to php

Code Explorer Popular Question For Shell