本文整理汇总了PHP中vcExtractDimensions函数的典型用法代码示例。如果您正苦于以下问题:PHP vcExtractDimensions函数的具体用法?PHP vcExtractDimensions怎么用?PHP vcExtractDimensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vcExtractDimensions函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
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;
示例2: die
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);