Php saves any network image to the server ,. Php saves any network image to the server. this example describes how php saves any network image to the server. Share it with you for your reference. The specific analysis is as follows: any php method to save any network image to the server,
This example describes how php saves any network image to the server. Share it with you for your reference. The specific analysis is as follows:
Specify any network Image address and use this function to download it to the local server.
<? Phpfunction saveImage ($ path) {if (! Preg_match ('/\/([^ \/] + \. [a-z] {3, 4}) $/I ', $ path, $ matches) die ('use image please '); $ image_name = strToLower ($ matches [1]); $ ch = curl_init ($ path); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_BINARYTRANSFER, 1); $ img = curl_exec ($ ch); curl_close ($ ch); $ fp = fopen ($ image_name, 'w'); fwrite ($ fp, $ img ); fclose ($ fp);} saveImage ('http: // www.bkjia.com/images/logo.jpg');?>
I hope this article will help you with php programming.
Example: This article describes how php saves any network image to the server. Share it with you for your reference. The specific analysis is as follows: ren...