Copy Image Url or Link to Local Machine::
public function copy_image_from_url(){
//New Image Directory Path::
$targetPath = 'path/to/Directory/';
//New image Name
$newImageExt = '.png';
$newImageName = time().$newImageExt;
//New image Full Path
$targetImagePath = $targetPath.$newImageName;
$copyImageUrl = "https://images-na.ssl-images-amazon.com/images/I/41LH4pXAe6L.jkhjk000_.jpg";
$copied = copy($copyImageUrl, $targetImagePath);
// If Copy Image Success it returns TRUE, Else FALSE;
if($copied){
print_r('Image Copied');
}else{
print_r('Failed To Copy');
}
}
public function copy_image_from_url(){
//New Image Directory Path::
$targetPath = 'path/to/Directory/';
//New image Name
$newImageExt = '.png';
$newImageName = time().$newImageExt;
//New image Full Path
$targetImagePath = $targetPath.$newImageName;
$copyImageUrl = "https://images-na.ssl-images-amazon.com/images/I/41LH4pXAe6L.jkhjk000_.jpg";
$copied = copy($copyImageUrl, $targetImagePath);
// If Copy Image Success it returns TRUE, Else FALSE;
if($copied){
print_r('Image Copied');
}else{
print_r('Failed To Copy');
}
}
No comments:
Post a Comment