コード例 #1
0
ファイル: imgs.php プロジェクト: sonyarianto/cimage
 public function downloadRemoteSource($src)
 {
     if (!$this->isRemoteSourceOnWhitelist($src)) {
         throw new Exception("Hostname is not on whitelist for remote sources.");
     }
     $remote = new CRemoteImage();
     $cache = $this->saveFolder . "/remote/";
     if (!is_dir($cache)) {
         if (!is_writable($this->saveFolder)) {
             throw new Exception("Can not create remote cache, cachefolder not writable.");
         }
         mkdir($cache);
         $this->log("The remote cache does not exists, creating it.");
     }
     if (!is_writable($cache)) {
         $this->log("The remote cache is not writable.");
     }
     $remote->setCache($cache);
     $remote->useCache($this->useCache);
     $src = $remote->download($src);
     $this->log("Remote HTTP status: " . $remote->getStatus());
     $this->log("Remote item is in local cache: {$src}");
     $this->log("Remote details on cache:" . print_r($remote->getDetails(), true));
     return $src;
 }
コード例 #2
0
ファイル: imgs.php プロジェクト: szunyi/cimage
 public function downloadRemoteSource($src)
 {
     if (!$this->isRemoteSourceOnWhitelist($src)) {
         throw new Exception("Hostname is not on whitelist for remote sources.");
     }
     $remote = new CRemoteImage();
     if (!is_writable($this->remoteCache)) {
         $this->log("The remote cache is not writable.");
     }
     $remote->setCache($this->remoteCache);
     $remote->useCache($this->useCache);
     $src = $remote->download($src);
     $this->log("Remote HTTP status: " . $remote->getStatus());
     $this->log("Remote item is in local cache: {$src}");
     $this->log("Remote details on cache:" . print_r($remote->getDetails(), true));
     return $src;
 }