Example #1
0
 public static function download_photo($photo_url, $stalkee_id)
 {
     $stalkee_dir = self::$DOWNLOAD_FOLDER . '/' . $stalkee_id;
     if (!file_exists($stalkee_dir)) {
         mkdir($stalkee_dir, 0777, true);
     }
     $latest_image = $stalkee_dir . "/" . PhotoDownloader::get_latest_photo($stalkee_id);
     $time = time();
     $image_name = $stalkee_dir . '/' . $time . '.jpg';
     if (PhotoDownloader::check_new_file($latest_image, $photo_url)) {
         file_put_contents($image_name, file_get_contents($photo_url));
         Stalkee::insert_photo_db($stalkee_id, $time, 1);
     }
 }