コード例 #1
0
ファイル: ImageCache.php プロジェクト: rulemaker/jitimage
 /**
  * {@inheritdoc}
  */
 public function get($key, $raw = false)
 {
     if ($this->has($key)) {
         $this->image->close();
         $this->image->load($this->pool[$key]);
         return $raw ? $this->image->getImageBlob() : $this->image;
     }
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function resolve()
 {
     $this->image->close();
     if (!$this->canResolve()) {
         return false;
     }
     $this->parseAll();
     if ($this->config->cache && ($image = $this->resolveFromCache($id = $this->getImageRequestId($this->getInputQuery(), $this->input['source'])))) {
         return $image;
     }
     // something went wrong
     if (!($img = $this->isReadableFile($this->parameter))) {
         return false;
     }
     // something went wrong
     if (!$this->image->load($img)) {
         return false;
     }
     $this->image->process($this);
     if ($this->config->cache) {
         $this->processCache->put($id, $this->image->getContents());
     }
     return $this->image;
 }