| | |
| | | public function __construct() |
| | | { |
| | | $this->cache = CacheManager::for('images')->connectTo('post', 'attachment'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->clear(); |
| | | } |
| | | } |
| | | |
| | | public function formatImage(int $ID, string $start = 'tiny', string $replace = 'large', bool $addLink = true, ?string $postSlug = null):string |
| | |
| | | ['ID' => $ID, 'start' => $start, 'replace' => $replace], |
| | | function() use ($ID, $start, $replace) { |
| | | // Define size order for progressive enhancement |
| | | $sizeOrder = ['tiny', 'medium', 'large', 'full']; |
| | | $sizeOrder = ['tiny', 'directory-preview', 'thumbnail', 'medium', 'large', 'full']; |
| | | $startIndex = array_search($start, $sizeOrder); |
| | | $replaceIndex = array_search($replace, $sizeOrder); |
| | | |