Ejemplo n.º 1
0
 }
 foreach ($images as $i => $image) {
     switch ($source) {
         case 'media_library':
             if ($image > 0) {
                 $img = wpb_getImageBySize(array('attach_id' => $image, 'thumb_size' => $img_size));
                 $thumbnail = $img['thumbnail'];
                 $large_img_src = $img['p_img_large'][0];
             } else {
                 $large_img_src = $default_src;
                 $thumbnail = '<img src="' . $default_src . '" />';
             }
             break;
         case 'external_link':
             $image = esc_attr($image);
             $dimensions = vcExtractDimensions($external_img_size);
             $hwstring = $dimensions ? image_hwstring($dimensions[0], $dimensions[1]) : '';
             $thumbnail = '<img ' . $hwstring . ' src="' . $image . '" />';
             $large_img_src = $image;
             break;
     }
     $link_start = $link_end = '';
     switch ($onclick) {
         case 'img_link_large':
             $link_start = '<a href="' . $large_img_src . '" target="' . $custom_links_target . '">';
             $link_end = '</a>';
             break;
         case 'link_image':
             $link_start = '<a class="prettyphoto" href="' . $large_img_src . '"' . $pretty_rel_random . '>';
             $link_end = '</a>';
             break;
Ejemplo n.º 2
0
    die('-1');
}
$el_class = $image = $img_size = $img_link = $img_link_target = $img_link_large = $title = $alignment = $css_animation = $css = '';
/** @var $this WPBakeryShortCode_VC_Single_image */
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
extract($atts);
$default_src = vc_asset_url('vc/no_image.png');
$style = '' !== $style ? $style : '';
$border_color = '' !== $border_color ? ' vc_box_border_' . $border_color : '';
$img_id = preg_replace('/[^\\d]/', '', $image);
switch ($source) {
    case 'media_library':
        $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'vc_single_image-img'));
        break;
    case 'external_link':
        $dimensions = vcExtractDimensions($img_size);
        $hwstring = $dimensions ? image_hwstring($dimensions[0], $dimensions[1]) : '';
        $custom_src = $custom_src ? esc_attr($custom_src) : $default_src;
        $img = array('thumbnail' => '<img class="vc_single_image-img" ' . $hwstring . ' src="' . $custom_src . '" />');
        break;
    default:
        $img = false;
}
if (!$img) {
    $img['thumbnail'] = '<img class="vc_single_image-img" src="' . $default_src . '" />';
}
$wrapperClass = 'vc_single_image-wrapper ' . $style . ' ' . $border_color;
$link = vc_gitem_create_link($atts, $wrapperClass);
$image_string = !empty($link) ? '<' . $link . '>' . $img['thumbnail'] . '</a>' : '<div class="' . $wrapperClass . '"> ' . $img['thumbnail'] . ' </div>';
$class_to_filter = 'wpb_single_image wpb_content_element vc_align_' . $alignment . ' ' . $this->getCSSAnimation($css_animation);
$class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class);