Created
July 4, 2015 22:16
-
-
Save Shaz3e/433a6ac9aa5701cf3802 to your computer and use it in GitHub Desktop.
Download & save a remote image on your server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Downloading an image on a remote server and saving it on your own server is useful when building websites, and it’s also very easy to do. The two lines of code below will do it for you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$image = file_get_contents('http://www.url.com/image.jpg'); | |
file_put_contents('/images/image.jpg', $image); //Where to save the image | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment