Remix919
01-08-2012, 07:34 PM
I'm trying to create a directory using mkdir() but it seems to work fine outside the function, but when I put the code inside the function it won't work. Here is the code I'm using:
class Scrapper extends xhttp{
private function dl_images($images){
$getyear = date("Y");
$getmonth = date("m");
$getday = date("d");
$pickey = 1;
foreach($images AS $image):
$post_id = $this->db->insert_id;
$thumb_folder = "../classifieds/images/$getyear/$getmonth/$getday/$post_id/";
mkdir("$thumb_folder", 0755);
$image = str_replace("medium","large",$image);
if(!$this->is_image($image)) continue;
$img = file_get_contents($image);
$image_name = end( explode("/", $image ) );
file_put_contents( $thumb_folder . $image_name , $img );
$pickey++;
endforeach; // END OF LOOPING THROUGH IMAGES
}
}
class Scrapper extends xhttp{
private function dl_images($images){
$getyear = date("Y");
$getmonth = date("m");
$getday = date("d");
$pickey = 1;
foreach($images AS $image):
$post_id = $this->db->insert_id;
$thumb_folder = "../classifieds/images/$getyear/$getmonth/$getday/$post_id/";
mkdir("$thumb_folder", 0755);
$image = str_replace("medium","large",$image);
if(!$this->is_image($image)) continue;
$img = file_get_contents($image);
$image_name = end( explode("/", $image ) );
file_put_contents( $thumb_folder . $image_name , $img );
$pickey++;
endforeach; // END OF LOOPING THROUGH IMAGES
}
}