<?php
function downimage($image_url, $image_name, $image_path){
$image_name = $this->pretty_string($image_name);
$image_file = $image_name . '.jpg';
if( ! file_exists($image_path . $image_file) ){
$ch = @curl_init($image_url);
$fp = @fopen('../'.$image_path .'/'. $image_file, 'w+');
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
@curl_setopt($ch, CURLOPT_REFERER, $image_url);
@curl_setopt($ch, CURLOPT_HEADER,0);
@curl_setopt($ch, CURLOPT_FILE, $fp);
@curl_exec($ch);
@curl_close($ch);
@fclose($fp);
}
}
?>