コード例 #1
0
 public function getBinary(File $file)
 {
     $id = trim($file->getId(), '/');
     $fileName = pathinfo($id, PATHINFO_FILENAME);
     if ($fileName != '') {
         return @file_get_contents($this->baseFolder . '/' . $id);
     }
     return false;
 }
コード例 #2
0
 public function getBinary(File $file)
 {
     $url = 'file/' . trim($file->getId(), '/');
     try {
         $response = $this->getClient()->get($url);
         return $response->getBody()->getContents();
     } catch (ClientException $e) {
         if ($e->getResponse()->getStatusCode() == 404) {
             return false;
         }
         throw new ClientException($e->getMessage(), $e->getRequest(), $e->getResponse(), $e);
     }
 }
コード例 #3
0
 public function getBinary(File $file)
 {
     $this->connect();
     if (file_exists($this->scheme . '/' . $file->getId())) {
         return @file_get_contents($this->scheme . '/' . $file->getId());
     }
     return false;
 }
コード例 #4
0
 protected function mustBuildImage(File $file, $filename)
 {
     if ($this->timestampCheck == false) {
         return true;
     }
     $fs = new Filesystem();
     if (!$fs->exists($this->basePath . '/' . $filename)) {
         return true;
     }
     $info = new \SplFileInfo($this->basePath . '/' . $filename);
     if ($file->getTimestampLastChange() > $info->getCTime()) {
         return true;
     }
     // Change timestamp of the file, to mark it as "active"
     $fs->touch($this->basePath . '/' . $filename);
     return false;
 }