Quantcast
Viewing all articles
Browse latest Browse all 2

Answer by David Normington for Caching images locally from external json feed

You can use file_get_contents to grab the image data and file_put_contents to save the image to your file system. Then modifying the JSON is as easy as changing the value in the JSON decoded array, then re-encoding it.

//example for JPEG image
$image = file_get_contents($imageUrl);
file_put_contents('MyImage.jpg', $image);

Viewing all articles
Browse latest Browse all 2

Trending Articles