$output = curl_exec($ch); curl_close($ch); return $output; } public function copyIMGS() { $images = array(); $images[] = 'https://pp.vk.me/c410118/v410118197/7533/w1sahwpcIGQ.jpg'; $images[] = 'https://pp.vk.me/c624029/v624029197/5d22/aFqYSgFiYyI.jpg'; foreach ($images as $key => $value) { $content = $this->url_get_contents($value); file_put_contents('tmp/images/array[' . $key . '].jpg', $content); } } public function getAllImages() { $directory = "tmp/images/"; $images = glob($directory . "*.jpg"); return $images; } } $imageGrid = new imageGrid(800, 600, 10, 10); $imageGrid->demoGrid(); $images = $imageGrid->getAllImages(); foreach ($images as $key => $image) { $img = imagecreatefromjpeg($image); $imageGrid->putImage($img, 1, 1, 2, 5); } $imageGrid->display(); $imageGrid->copyIMGS(); $imageGrid->getAllImages();