/**
     * Image Gallery - Single Image Shortcode
     * 
     * @param  array $atts
     * @param  string $content
     * @return html
     */
    function rt_gal_item($atts, $content = null)
    {
        global $rt_image_gallery_globals, $rt_global_variables;
        //defaults
        extract(shortcode_atts(array("id" => '', "class" => '', "image_id" => '', "image_url" => '', "custom_link" => '', "title" => '', "action" => 'lightbox', "link_target" => '_self'), $atts));
        //variables
        $output = $caption_output = $lightbox_link = $image_effect = "";
        // Thumbnail width & height
        $w = rt_get_min_resize_size($rt_image_gallery_globals["list_layout"]);
        $h = $rt_image_gallery_globals["crop"] == "true" ? $w : 10000;
        // Get image data
        $image_args = array("image_url" => $image_url, "image_id" => $image_id, "w" => $w, "h" => $h, "crop" => $rt_image_gallery_globals["crop"]);
        $image_output = rt_get_image_data($image_args);
        //tooltip
        $tooltip = $rt_image_gallery_globals["tooltips"] == "true" ? ' data-placement="top" data-toggle="tooltip" data-original-title="' . $title . '"' : "";
        //create lightbox link
        if ($action == "lightbox") {
            $image = rt_create_lightbox_link(array('class' => 'zoom lightbox_ imgeffect', 'href' => $image_output["image_url"], 'title' => $title, 'data_group' => $rt_image_gallery_globals["gallery_id"], 'data_title' => $title, 'data_description' => "", 'tooltip' => $rt_image_gallery_globals["tooltips"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'inner_content' => '<img src="' . $image_output["thumbnail_url"] . '" alt="' . $title . '" class="img-responsive">', 'echo' => false));
        } elseif ($action == "custom_link") {
            $image = sprintf('
			<a href="%1$s" title="%2$s" target="%3$s" class="link icon imgeffect">
				<img src="%4$s" class="img-responsive" alt="%2$s"%5$s>
			</a>', $custom_link, $title, $link_target, $image_output["thumbnail_url"], $tooltip);
        } else {
            $image = sprintf('<img src="%s" class="img-responsive" alt="%s"%s> ', $image_output["thumbnail_url"], $title, $tooltip);
        }
        //create caption
        $caption_output = !empty($content) ? '<div class="caption">' . rt_visual_composer_content_fix($content, "true") . '</div>' : "";
        //open holder
        if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 1 || $rt_image_gallery_globals["column_count"] == 1) {
            $output .= '<div class="row fixed_heights">';
        }
        //id attr
        $id_attr = !empty($id) ? 'id="' . $id . '"' : "";
        //list items output
        $output .= sprintf('
		<div %1$s class="col %3$s col-xs-12 %2$s"> 		
 			%4$s
 			%5$s
		</div>
	', $id_attr, $class, rt_column_class($rt_image_gallery_globals["list_layout"]), $image, $caption_output);
        //close holder
        if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 0 || $rt_image_gallery_globals["item_count"] == $rt_image_gallery_globals["counter"]) {
            $output .= '</div>';
        }
        //increase counter
        $rt_image_gallery_globals["counter"]++;
        return $output;
    }
示例#2
0
    function rt_create_photo_gallery($atts)
    {
        //defaults
        extract(shortcode_atts(array("gallery_id" => 'gallery-' . rand(100000, 1000000), "crop" => false, "h" => "", "image_urls" => array(), "image_ids" => array(), "lightbox" => false, "captions" => true, "item_width" => ""), $atts));
        //if w & h suplied li's are fluid
        $item_width = empty($item_width) ? 6 : $item_width;
        //image array
        $image_array = !empty($image_urls) ? $image_urls : $image_ids;
        //layout name values
        $layout_values = array('', 'one', 'two', 'three', 'four', 'five', 'fluid');
        //create values
        $items_output = $caption_output = $lightbox_link = $image_effect = "";
        // Thumbnail width & height
        $w = rt_get_min_resize_size($item_width);
        if (empty($h)) {
            $h = $crop ? $w / 1.5 : 10000;
        }
        $counter = 1;
        foreach ($image_array as $image) {
            // get the column class name
            $add_class = $layout_values[$item_width];
            //add first last classes
            if ($counter % $item_width == 1 || $item_width == 1) {
                $add_class .= " first";
            }
            if ($counter % $item_width == 0 || count($image_array) == $counter && !strpos($add_class, "first")) {
                $add_class .= " last";
            }
            // Get image data
            $image_args = array("image_url" => "", "image_id" => "", "w" => $w, "h" => $h, "crop" => $crop);
            if (!empty($image_urls)) {
                $image_args["image_url"] = $image;
            } else {
                $image_args["image_id"] = $image;
            }
            $image_output = rt_get_image_data($image_args);
            //create lightbox link
            if ($lightbox) {
                $lightbox_link = rt_create_lightbox_link(array('class' => 'icon-zoom-in lightbox_ single', 'href' => $image_output["image_url"], 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => $gallery_id, 'data_title' => $image_output["image_title"], 'data_description' => $image_output["image_caption"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'echo' => false));
                $image_effect = "imgeffect";
            }
            //create caption
            $caption_output = $captions && !empty($image_output["image_caption"]) ? sprintf('
				<p class="gallery-caption-text">%s</p>
			', $image_output["image_caption"]) : "";
            //list items output
            $items_output .= sprintf('
				<li class="box %s">
					<div class="%s" data-rt-animate="animate" data-rt-animation-type="fadeIn">	
						%s							
						<img src="%s" alt="%s"> 									
					</div>
					%s 	
				</li>
			', $add_class, $image_effect, $lightbox_link, $image_output["thumbnail_url"], $image_output["image_alternative_text"], $caption_output);
            $counter++;
        }
        //the gallery holder output
        $gallery_holder_output = sprintf('
			<div class="row clearfix">
				<ul class="photo_gallery" id="%s" data-rt-animation-group="group">%s</ul> 
			</div>
		', $gallery_id, $items_output);
        echo $gallery_holder_output;
    }
 /**
  * Create a carousel from the provided images
  *
  * @since 1.0
  * 
  * @param  array $rt_gallery_images  
  * @param  string $id  
  * @return output html
  */
 function rt_create_image_carousel($atts = array())
 {
     //defaults
     extract(shortcode_atts(array("id" => 'carousel-' . rand(100000, 1000000), "crop" => false, "h" => 10000, "w" => 10000, "rt_gallery_images" => array(), "column_width" => "1/1", "carousel_atts" => array(), "echo" => true, "lightbox" => "true"), $atts));
     //slider id
     $slider_id = "slider-" . $id;
     //crop
     $crop = $crop === "false" ? false : $crop;
     //image dimensions for product image slider
     $w = empty($w) ? rt_get_min_resize_size($column_width) : $w;
     //height
     if (empty($h)) {
         $h = $crop ? $w / 1.5 : 10000;
     }
     //create slides and thumbnails outputs
     $output = array();
     foreach ($rt_gallery_images as $image) {
         // Resize Image
         $image_output = is_numeric($image) ? rt_get_image_data(array("image_id" => trim($image), "w" => $w, "h" => $h, "crop" => $crop)) : rt_get_image_data(array("image_url" => trim($image), "w" => $w, "h" => $h, "crop" => $crop));
         if ($lightbox != "false") {
             //create lightbox link
             $output[] = rt_create_lightbox_link(array('class' => 'imgeffect zoom lightbox_', 'href' => $image_output["image_url"], 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => $slider_id, 'data_title' => $image_output["image_title"], 'data_description' => $image_output["image_caption"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'echo' => false, 'inner_content' => sprintf('<img src="%s" alt="%s" itemprop="image">', $image_output["thumbnail_url"], $image_output["image_alternative_text"])));
         } else {
             $output[] = sprintf('<img src="%s" alt="%s" itemprop="image">', $image_output["thumbnail_url"], $image_output["image_alternative_text"]);
         }
     }
     //create slider
     if ($echo) {
         echo rt_create_carousel($output, $carousel_atts);
     } else {
         return rt_create_carousel($output, $carousel_atts);
     }
 }
示例#4
0
    //image max height
    $h = $rt_crop ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'portfolio_max_image_height', true) : 10000;
    //Thumbnail dimensions
    $w = rt_get_min_resize_size(1);
    ?>


					<?php 
    /*
     *
     * Single Image
     *
     */
    if (is_array($rt_gallery_images) && count($rt_gallery_images) == 1) {
        // Get image data
        $image_output = rt_get_image_data(array("image_url" => $image, "w" => $w, "h" => $h, "crop" => $rt_crop));
    }
    if (!empty($image_output["thumbnail_url"])) {
        ?>
							<!-- portfolio image -->
								<div class="imgeffect"> 

									<?php 
        //create lightbox link
        if (!$disable_lightbox) {
            do_action("create_lightbox_link", array('class' => 'icon-zoom-in lightbox_ single', 'href' => $image_output["image_url"], 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => 'single_portfolio', 'data_title' => $image_output["image_title"], 'data_description' => $image_output["image_caption"]));
        }
        ?>

									<img src="<?php 
        echo $image_output["thumbnail_url"];
示例#5
0
    function rt_auto_thumb($atts, $content = null)
    {
        //[auto_thumb width="" height="" link="" lightbox="" align="" title="" alt="" iframe="" frame=""]
        //defaults
        extract(shortcode_atts(array("width" => '135', "height" => '135', "link" => '', "lightbox" => 'true', "align" => 'alignleft', "title" => '', "alt" => '', "crop" => true), $atts));
        //width and height
        if ($width == "") {
            $width = "135";
        }
        if ($height == "") {
            $height = "135";
        }
        //crop
        if ($crop == "false") {
            $height = 100000;
            $crop = false;
        }
        //random id
        $randomID = rand(100000, 1000000);
        //if it's not a video
        if ($link == "" && $lightbox != "false") {
            $link = $content;
        }
        /* icon */
        if (preg_match("/(png|jpg|gif)/", trim($link))) {
            $icon = "icon-zoom-in";
        } elseif (preg_match("/(youtube|vimeo)/", trim($link))) {
            $icon = "icon-right-dir";
        } else {
            $icon = "icon-link";
        }
        //the photo url
        //clear p and br tags
        $content = preg_replace('#^<\\/p>|<p>$#', '', trim($content));
        $content = preg_replace('#^<p>|<\\/p>$#', '', trim($content));
        $content = preg_replace('#^<br />$#', '', trim($content));
        $photo = trim($content);
        // Get image data
        $image_args = array("image_url" => $photo, "image_id" => "", "w" => $width, "h" => $height, "crop" => $crop);
        $image_output = rt_get_image_data($image_args);
        //create lightbox link
        if ($lightbox != "false") {
            $lightbox_link = rt_create_lightbox_link(array('class' => $icon . ' lightbox_ single', 'href' => $link, 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => "image" . $randomID, 'data_title' => $title, 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'echo' => false));
        } elseif ($link == "" && $lightbox == "false") {
            $lightbox_link = "";
        } else {
            $lightbox_link = sprintf('
			<a href="%s" class="icon-link single" title=""></a>', $link, $title);
        }
        //output
        $output = sprintf('
		<div class="imgeffect single_image %s">	
			%s							
			<img src="%s" alt="%s"> 									
		</div>
	', $align, $lightbox_link, $image_output["thumbnail_url"], $title);
        return $output;
    }