/** * Save the image with cache. * * @return mixed|string */ protected function saveImage() { if (!$this->image) { return parent::path(false); } if ($this->get('debug') && !$this->debug_watermarked) { $ratio = $this->get('ratio'); if (!$ratio) { $ratio = 1; } $locator = self::$grav['locator']; $overlay = $locator->findResource("system://assets/responsive-overlays/{$ratio}x.png") ?: $locator->findResource('system://assets/responsive-overlays/unknown.png'); $this->image->merge(ImageFile::open($overlay)); } $result = $this->image->cacheFile($this->format, $this->quality); return $result; }