| | |
| | | |
| | | public function __construct() |
| | | { |
| | | $this->cache = Cache::for('images')->connect('post'); |
| | | $this->imgData = Cache::for('imageData')->connect('post'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | $this->imgData->flush(); |
| | | } |
| | | $this->cache = Cache::for('images', 'post'); |
| | | $this->imgData = Cache::for('imageData', 'post'); |
| | | } |
| | | |
| | | public function formatImage(int $ID, string $start = 'tiny', string $replace = 'large', bool $addLink = true, ?string $postSlug = null):string |
| | | { |
| | | $return = $this->cache->remember( |
| | | $this->cache->generateKey(['ID' => $ID, 'start' => $start, 'replace' => $replace]), |
| | | ['ID' => $ID, 'start' => $start, 'replace' => $replace], |
| | | function() use ($ID, $start, $replace) { |
| | | // Define size order for progressive enhancement |
| | | $sizeOrder = ['tiny', 'directory-preview', 'thumbnail', 'medium', 'large', 'full']; |
| | |
| | | public static function SVG(string $slug):string |
| | | { |
| | | $cache = Cache::for('svgs'); |
| | | if (JVB_TESTING) { |
| | | $cache->flush(); |
| | | } |
| | | |
| | | return $cache->remember( |
| | | $slug, |
| | | function() use ($slug) { |