/** * Renders the thumbnail preview field * * @param $field array * @param $gallery FooGallery * @param $template array */ function render_thumbnail_preview($field, $gallery, $template) { if ('default_thumb_preview' == $field['type']) { $args = $gallery->get_meta('default_thumbnail_dimensions', array('width' => get_option('thumbnail_size_w'), 'height' => get_option('thumbnail_size_h'), 'crop' => true)); //override the link so that it does not actually open an image $args['link'] = 'custom'; $args['custom_link'] = '#preview'; $hover_effect = $gallery->get_meta('default_hover-effect', 'hover-effect-zoom'); $border_style = $gallery->get_meta('default_border-style', 'border-style-square-white'); $hover_effect_type = $gallery->get_meta('default_hover-effect-type', ''); $caption_hover_effect = $gallery->get_meta('default_caption-hover-effect', 'hover-caption-simple'); $featured = $gallery->featured_attachment(); if (false === $featured) { $featured = new FooGalleryAttachment(); $featured->url = FOOGALLERY_URL . 'assets/test_thumb_1.jpg'; $featured->caption = __('Caption Title', 'foogallery'); $featured->description = __('Long Caption Description Text', 'foogallery'); } echo '<div class="foogallery-default-preview ' . foogallery_build_class_attribute($gallery, $hover_effect, $border_style, $hover_effect_type, $caption_hover_effect, 'foogallery-thumbnail-preview') . '">'; echo $featured->html($args, true, false); echo $featured->html_caption('both'); echo '</a>'; echo '</div>'; } }
function render_thumbnail_preview($field, $gallery, $template) { if ('image_viewer_preview' == $field['type']) { $args = $gallery->get_meta('thumbnail_size', array('width' => 640, 'height' => 360, 'crop' => true)); //override the link so that it does not actually open an image $args['link'] = 'custom'; $args['custom_link'] = '#preview'; $args['link_attributes'] = array('class' => 'fiv-active'); $hover_effect = $gallery->get_meta('image-viewer_hover-effect', 'hover-effect-zoom'); $hover_effect_type = $gallery->get_meta('image-viewer_hover-effect-type', ''); $featured = $gallery->featured_attachment(); if (false === $featured) { $featured = new FooGalleryAttachment(); $featured->url = FOOGALLERY_URL . 'assets/test_thumb_1.jpg'; } ?> <div class="foogallery-image-viewer-preview <?php echo foogallery_build_class_attribute($gallery, $hover_effect, $hover_effect_type); ?> "> <div class="fiv-inner"> <div class="fiv-inner-container"> <?php echo $featured->html($args, true, false); echo $featured->html_caption('both'); echo '</a>'; ?> </div> <div class="fiv-ctrls"> <div class="fiv-prev"><span><?php echo __('Prev'); ?> </span></div> <label class="fiv-count"><span class="fiv-count-current">1</span><?php echo __('of'); ?> <span>1</span></label> <div class="fiv-next"><span><?php echo __('Next'); ?> </span></div> </div> </div> </div><?php } }
/** * Gets the featured image FooGalleryAttachment object. If no featured image is set, then get back the first image in the gallery * * @return bool|FooGalleryAttachment */ public function featured_attachment() { $attachment_id = $this->find_featured_attachment_id(); if ($attachment_id) { return FooGalleryAttachment::get_by_id($attachment_id); } return false; }