| | |
| | | $this->imgData = Cache::for('imageData')->connect('post'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | $this->imgData->flush(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if ($addLink) { |
| | | if (!$postSlug) { |
| | | global $post; |
| | | $postSlug = $post->post_name; |
| | | if (is_singular()) { |
| | | global $post; |
| | | $postSlug = $post->post_name; |
| | | }else if (is_tax()) { |
| | | $tax = get_queried_object(); |
| | | $postSlug = jvbNoBase($tax->taxonomy); |
| | | }elseif (is_post_type_archive()) { |
| | | $obj = get_queried_object(); |
| | | $postSlug = jvbNoBase($obj->post_type); |
| | | } |
| | | |
| | | } |
| | | $full = wp_get_attachment_image_src($ID, 'full'); |
| | | |
| | |
| | | $postSlug, |
| | | $postSlug, |
| | | $imgSlug, |
| | | $full[0] |
| | | $full[0]??'' |
| | | ); |
| | | |
| | | // Add gallery attributes to img tag |
| | |
| | | } |
| | | ); |
| | | } |
| | | |
| | | public static function getData(int $imgID):array |
| | | { |
| | | return (new Image)->getImageData($imgID); |
| | | } |
| | | |
| | | } |