Created
March 1, 2011 17:00
-
-
Save melvinmt/849455 to your computer and use it in GitHub Desktop.
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 | |
// first, save medium image | |
$ch = curl_init($medium['source']); | |
$medium_local_path = UPLOAD_DIR.'/'.time().'_'.basename($medium['source']); | |
$parse = parse_url($medium_local_path); | |
$medium_local_path = $parse['path']; // clean up dirty query strings from file name | |
$fh = fopen($medium_local_path, "w"); | |
curl_setopt($ch, CURLOPT_FILE, $fh); | |
curl_exec($ch); | |
curl_close($ch); | |
fclose($fh); | |
// then, the large image | |
$ch = curl_init($large['source']); | |
$large_local_path = UPLOAD_DIR.'/'.time().'_'.basename($large['source']); | |
$parse = parse_url($large_local_path); | |
$large_local_path = $parse['path']; // clean up dirty query strings from file name | |
$fh = fopen($large_local_path, "w"); | |
curl_setopt($ch, CURLOPT_FILE, $fh); | |
curl_exec($ch); | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment