• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP image_hwstring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中image_hwstring函数的典型用法代码示例。如果您正苦于以下问题:PHP image_hwstring函数的具体用法?PHP image_hwstring怎么用?PHP image_hwstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了image_hwstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: file_processValue

function file_processValue($Value, $Type, $Field, $Config, $EID)
{
    if (!empty($Value)) {
        //dump($Value);
        //dump($Type);
        //dump($Field);
        //dump($Config);
        //die;
        switch ($Type) {
            case 'image':
                $Value = strtok($Value, '?');
                $imageWidth = $Config['_ImageSizeX'][$Field] == 'auto' ? '100' : $Config['_ImageSizeX'][$Field];
                $imageHeight = $Config['_ImageSizeY'][$Field] == 'auto' ? '100' : $Config['_ImageSizeY'][$Field];
                $iconWidth = $Config['_IconSizeX'][$Field] == 'auto' ? '100' : $Config['_IconSizeX'][$Field];
                $iconHeight = $Config['_IconSizeY'][$Field] == 'auto' ? '100' : $Config['_IconSizeY'][$Field];
                $uploadVars = wp_upload_dir();
                $SourceFile = str_replace($uploadVars['baseurl'], $uploadVars['basedir'], $Value);
                if (!file_exists($SourceFile)) {
                    return 'Image does not exists.';
                }
                $dim = getimagesize($SourceFile);
                $newDim = image_resize_dimensions($dim[0], $dim[1], $iconWidth, $iconHeight, true);
                if (!empty($newDim)) {
                    $Sourcepath = pathinfo($SourceFile);
                    $URLpath = pathinfo($Value);
                    $iconURL = $URLpath['dirname'] . '/' . $URLpath['filename'] . '-' . $newDim[4] . 'x' . $newDim[5] . '.' . $URLpath['extension'];
                    if (!file_exists($Sourcepath['dirname'] . '/' . $Sourcepath['filename'] . '-' . $newDim[4] . 'x' . $newDim[5] . '.' . $Sourcepath['extension'])) {
                        $image = image_resize($SourceFile, $imageWidth, $imageHeight, true);
                        $icon = image_resize($SourceFile, $iconWidth, $iconHeight, true);
                    }
                } else {
                    $iconURL = $Value;
                    $iconWidth = $dim[0];
                    $iconHeight = $dim[1];
                }
                $ClassName = '';
                if (!empty($Config['_ImageClassName'][$Field])) {
                    $ClassName = 'class="' . $Config['_ImageClassName'][$Field] . '" ';
                }
                if (!empty($Config['_IconURLOnly'][$Field])) {
                    return $iconURL;
                }
                return '<img src="' . $iconURL . '" ' . $ClassName . image_hwstring($iconWidth, $iconHeight) . '>';
                break;
            case 'mp3':
                $File = explode('?', $Value);
                $UniID = uniqid($EID . '_');
                //$ReturnData = '<span id="'.$UniID.'">'.$File[1].'</span>';
                $ReturnData = '<audio id="' . $UniID . '" src="' . $File[0] . '">unavailable</audio>';
                $_SESSION['dataform']['OutScripts'] .= "\n\t\t\t\t\tAudioPlayer.embed(\"" . $UniID . "\", {\n\t\t\t\t\t";
                if (!empty($Config['_PlayerCFG']['Autoplay'][$Field])) {
                    $_SESSION['dataform']['OutScripts'] .= " autostart: 'yes', ";
                }
                if (!empty($Config['_PlayerCFG']['Animation'][$Field])) {
                    $_SESSION['dataform']['OutScripts'] .= " animation: 'yes', ";
                }
                $_SESSION['dataform']['OutScripts'] .= "\n                                                transparentpagebg: 'yes',\n\t\t\t\t\t\tsoundFile: \"" . $File[0] . "\",\n\t\t\t\t\t\ttitles: \"" . $File[1] . "\"\n\t\t\t\t\t});\n\n\t\t\t\t";
                $_SESSION['dataform']['OutScripts'] .= "\n                                jQuery(document).ready(function(\$) {\n                                    AudioPlayer.setup(\"" . WP_PLUGIN_URL . "/db-toolkit/data_form/fieldtypes/file/player.swf\", {\n                                        width: '100%',\n                                        initialvolume: 100,\n                                        transparentpagebg: \"yes\",\n                                        left: \"000000\",\n                                        lefticon: \"FFFFFF\"\n                                    });\n                                 });";
                return $ReturnData;
                break;
            case 'file':
            case 'multi':
                if (empty($Config['_fileReturnValue'][$Field])) {
                    $Config['_fileReturnValue'][$Field] = 'iconlink';
                }
                $pathInfo = pathinfo($Value);
                $s3Enabled = false;
                $prime = $Field;
                if (!empty($Config['_CloneField'][$Field]['Master'])) {
                    $prime = $Config['_CloneField'][$Field]['Master'];
                }
                if (!empty($Config['_enableS3'][$prime]) && !empty($Config['_AWSAccessKey'][$prime]) && !empty($Config['_AWSSecretKey'][$prime])) {
                    include_once DB_TOOLKIT . 'data_form/fieldtypes/file/s3.php';
                    $s3 = new S3($Config['_AWSAccessKey'][$prime], $Config['_AWSSecretKey'][$prime]);
                    $s3Enabled = true;
                }
                switch ($Config['_fileReturnValue'][$Field]) {
                    case 'iconlink':
                        if (empty($Value)) {
                            return 'no file uploaded';
                        }
                        if (!empty($Config['_enableS3'][$prime]) && !empty($Config['_AWSAccessKey'][$prime]) && !empty($Config['_AWSSecretKey'][$prime])) {
                            $File = 'http://' . $Config['_AWSBucket'][$prime] . '.s3.amazonaws.com/' . $Value;
                        } else {
                            $File = $Value;
                        }
                        $Dets = pathinfo($File);
                        $ext = strtolower($Dets['extension']);
                        if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif')) {
                            $Icon = '<img src="' . WP_PLUGIN_URL . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif" align="absmiddle" />&nbsp;';
                        } else {
                            $Icon = '<img src="' . WP_PLUGIN_URL . '/db-toolkit/data_form/fieldtypes/file/icons/file.gif" align="absmiddle" />&nbsp;';
                        }
                        return '<a href="' . $File . '">' . $Icon . ' ' . basename($File) . '</a>';
                        break;
                    case 'filesize':
                        if (!empty($s3Enabled)) {
                            $object = $s3->getObjectInfo($Config['_AWSBucket'][$prime], $Value);
                            return file_return_bytes($object['size']);
                        } else {
//.........这里部分代码省略.........
开发者ID:routexl,项目名称:DB-Toolkit,代码行数:101,代码来源:functions.php


示例2: dt_metabox_benefits_options

function dt_metabox_benefits_options($post)
{
    $box_name = 'dt_benefits_options';
    $defaults = array('retina_image' => '', 'retina_image_w' => 0, 'retina_image_h' => 0, 'retina_image_id' => null);
    $opts = get_post_meta($post->ID, '_' . $box_name, true);
    $opts = wp_parse_args(maybe_unserialize($opts), $defaults);
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), $box_name . '_nonce');
    // image
    $img_id = '<input type="hidden" value="' . $opts['retina_image_id'] . '" class="dt-uploader-textfield dt-get-id" name="' . $box_name . '_retina_image_id" />';
    // upload button
    $upload = dt_melement('link', array('description' => _x('Upload Image', 'backend benefits', LANGUAGE_ZONE), 'class' => 'dt-uploader-opener button-primary thickbox', 'href' => get_admin_url() . 'media-upload.php?post_id=' . $post->ID . '&type=image&TB_iframe=1&width=640&height=310'));
    // delete button
    $delete = dt_melement('link', array('description' => _x('Clear', 'backend benefits', LANGUAGE_ZONE), 'class' => 'dt-uploader-delete button', 'href' => '#'));
    ?>

	<p class="dt_switcher-box"><?php 
    if ($opts['retina_image_id']) {
        $img = wp_get_attachment_image_src($opts['retina_image_id'], 'medium');
        if ($img) {
            $size = wp_constrain_dimensions($img[1], $img[2], 266, 266);
            echo '<img class="attachment-266x266 dt-thumb" src="' . $img[0] . '" ' . image_hwstring($size[0], $size[1]) . ' />';
        }
    }
    echo $img_id . $upload . $delete;
    ?>
</p>
	
	<?php 
}
开发者ID:mnjit,项目名称:aa-global,代码行数:30,代码来源:metaboxes.php


示例3: zn_logo

 function zn_logo($logo = null, $use_transparent = false, $tag = null, $class = null)
 {
     $transparent_logo = '';
     if (!$tag) {
         if (is_front_page()) {
             $tag = 'h1';
         } else {
             $tag = 'h3';
         }
     }
     if ('transparent_header' == get_post_meta(zn_get_the_id(), 'header_style', true) && $use_transparent) {
         $transparent_logo = zget_option('transparent_logo', 'general_options');
     }
     if ($logo || ($logo = zget_option('logo', 'general_options'))) {
         // TODO: remove this as it is slow withouth the full path
         $logo_size = array('300', '100');
         //print_z($logo_size);
         $hwstring = image_hwstring($logo_size[0], $logo_size[1]);
         $logo = '<img class="non-transparent" src="' . set_url_scheme($logo) . '" ' . $hwstring . ' alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         if ($transparent_logo && $transparent_logo != ' ') {
             $logo .= '<img class="only-transparent" src="' . set_url_scheme($transparent_logo) . '" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         }
         $logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
     } else {
         $logo = '<img src="' . THEME_BASE_URI . '/images/logo.png" alt="' . get_bloginfo('name') . '" title="' . get_bloginfo('description') . '" />';
         $logo = "<{$tag} class='logo {$class}' id='logo'><a href='" . home_url('/') . "'>" . $logo . "</a></{$tag}>";
     }
     return $logo;
 }
开发者ID:fjbeteiligung,项目名称:development,代码行数:29,代码来源:functions-frontend.php


示例4: widget

 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, self::$widget_defaults);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_portfolio', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
     switch ($instance['select']) {
         case 'only':
             $args['tax_query'][0]['operator'] = 'IN';
             break;
         case 'except':
             $args['tax_query'][0]['operator'] = 'NOT IN';
             break;
         default:
             unset($args['tax_query']);
     }
     $p_query = new WP_Query($args);
     // for usage as shortcode
     if (!isset($img_size)) {
         $img_size = array($instance['max_width'], $instance['max_width']);
     }
     if (!isset($img_size_origin)) {
         $img_size_origin = $img_size;
     } else {
         $p = $img_size[1] / $img_size[0];
         $img_size_origin[1] = round($img_size_origin[0] * $p);
     }
     echo $before_widget;
     // title
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if ($p_query->have_posts()) {
         update_post_thumbnail_cache($p_query);
         echo '<div class="instagram-photos" data-image-max-width="' . absint($instance['max_width']) . '">';
         while ($p_query->have_posts()) {
             $p_query->the_post();
             $thumb_id = get_post_thumbnail_id(get_the_ID());
             if (!has_post_thumbnail(get_the_ID())) {
                 $args = array('posts_per_page' => 1, 'no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => 'inherit');
                 $images = new WP_Query($args);
                 if ($images->have_posts()) {
                     $thumb_id = $images->posts[0]->ID;
                 }
             }
             $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full');
             dt_get_thumb_img(array('img_meta' => $thumb_meta ? $thumb_meta : null, 'img_id' => $thumb_id, 'use_noimage' => true, 'class' => 'post-rollover', 'title' => get_the_title(), 'href' => get_permalink(), 'options' => array('w' => $img_size_origin[0], 'h' => $img_size_origin[1]), 'wrap' => "\n" . '<a %HREF% %TITLE% %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% ' . image_hwstring($img_size[0], $img_size[1]) . ' %ALT% /></a>' . "\n"));
         }
         // while have posts
         wp_reset_postdata();
         echo '</div>';
     }
     // if have posts
     echo $after_widget;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:56,代码来源:portfolio.php


示例5: wpjam_get_post_thumbnail

function wpjam_get_post_thumbnail($post = null, $size = 'thumbnail', $crop = 1, $class = "wp-post-image")
{
    $post_thumbnail_src = wpjam_get_post_thumbnail_src($post, $size, $crop);
    if ($post_thumbnail_src) {
        $size = wpjam_get_dimensions($size);
        extract($size);
        $hwstring = image_hwstring($width, $height);
        return '<img src="' . $post_thumbnail_src . '" alt="' . the_title_attribute(array('echo' => false)) . '" class="' . $class . '"' . $hwstring . ' />';
    } else {
        return false;
    }
}
开发者ID:yszar,项目名称:linuxwp,代码行数:12,代码来源:wpjam-thumbnail.php


示例6: getImageTag

 function getImageTag($id, $alt, $title, $align, $size = 'medium', $attrs = array())
 {
     list($img_src, $width, $height) = image_downsize($id, $size);
     $hwstring = image_hwstring($width, $height);
     $class = 'align' . esc_attr($align) . ' size-' . esc_attr($size) . ' wp-image-' . $id;
     $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
     $attrs_fields = '';
     foreach ($attrs as $name => $attr) {
         $attrs_fields .= ' ' . $name . '="' . esc_attr($attr) . '" ';
     }
     $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title) . '" ' . $hwstring . 'class="' . $class . '" ' . $attrs_fields . ' />';
     return $html;
 }
开发者ID:AgnaldoJaws,项目名称:belavista-wp,代码行数:13,代码来源:class.admin.php


示例7: get_image_html

 protected function get_image_html($image_id)
 {
     $image_html = '';
     if (wp_attachment_is_image($image_id)) {
         $image_src = wp_get_attachment_image_src($image_id, 'full');
         $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
         if (presscore_image_title_enabled($image_id)) {
             $image_title = ' title="' . esc_attr(get_the_title($image_id)) . '"';
         } else {
             $image_title = '';
         }
         $image_html = '<img class="preload-me" src="' . $image_src[0] . '" ' . image_hwstring($image_src[1], $image_src[2]) . $image_title . ' alt="' . esc_attr($image_alt) . '">';
     }
     return $image_html;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:15,代码来源:before-after.php


示例8: argo_get_image_tag

/**
 * argo_get_image_tag(): Renders an <img /> tag for attachments, scaling it
 * to $size and guaranteeing that it's not wider than the content well.
 *
 * This is largely taken from get_image_tag() in wp-includes/media.php.
 */
function argo_get_image_tag($html, $id, $alt, $title, $align, $size)
{
    // Never allow an image wider than the LARGE_WIDTH
    if ($size == 'full') {
        list($img_src, $width, $height) = wp_get_attachment_image_src($id, $size);
        if ($width > LARGE_WIDTH) {
            $size = 'large';
        }
    }
    list($img_src, $width, $height) = image_downsize($id, $size);
    $hwstring = image_hwstring($width, $height);
    // XXX: may not need all these classes
    $class = 'align' . esc_attr($align) . ' size-' . esc_attr($size) . ' wp-image-' . $id;
    $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
    $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title) . '" ' . $hwstring . 'class="' . $class . '" />';
    return $html;
}
开发者ID:regancarver,项目名称:Argo,代码行数:23,代码来源:images.php


示例9: wp_get_attachment_image

/**
 * Get an HTML img element representing an image attachment
 *
 * While `$size` will accept an array, it is better to register a size with
 * add_image_size() so that a cropped version is generated. It's much more
 * efficient than having to find the closest-sized image and then having the
 * browser scale down the image.
 *
 * @since 2.5.0
 *
 * @param int          $attachment_id Image attachment ID.
 * @param string|array $size          Optional. Registered image size or flat array of height and width
 *                                    dimensions. Default 'thumbnail'.
 * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
 * @param string|array $attr          Optional. Attributes for the image markup. Default empty.
 * @return string HTML img element or empty string on failure.
 */
function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '')
{
    $html = '';
    $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
    if ($image) {
        list($src, $width, $height) = $image;
        $hwstring = image_hwstring($width, $height);
        $size_class = $size;
        if (is_array($size_class)) {
            $size_class = join('x', $size_class);
        }
        $attachment = get_post($attachment_id);
        $default_attr = array('src' => $src, 'class' => "attachment-{$size_class}", 'alt' => trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true))));
        if (empty($default_attr['alt'])) {
            $default_attr['alt'] = trim(strip_tags($attachment->post_excerpt));
        }
        // If not, Use the Caption
        if (empty($default_attr['alt'])) {
            $default_attr['alt'] = trim(strip_tags($attachment->post_title));
        }
        // Finally, use the title
        $attr = wp_parse_args($attr, $default_attr);
        /**
         * Filter the list of attachment image attributes.
         *
         * @since 2.8.0
         *
         * @param array        $attr       Attributes for the image markup.
         * @param WP_Post      $attachment Image attachment post.
         * @param string|array $size       Requested size.
         */
        $attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment, $size);
        $attr = array_map('esc_attr', $attr);
        $html = rtrim("<img {$hwstring}");
        foreach ($attr as $name => $value) {
            $html .= " {$name}=" . '"' . $value . '"';
        }
        $html .= ' />';
    }
    return $html;
}
开发者ID:nstungxd,项目名称:F2CA5,代码行数:58,代码来源:media.php


示例10: raindrops_featured_image

 function raindrops_featured_image()
 {
     global $post, $is_IE, $raindrops_featured_image_full_size, $raindrops_use_featured_image_light_box;
     $raindrops_featured_image_enable = apply_filters('raindrops_featured_image_enable', true);
     if (is_single() && "hide" == raindrops_warehouse_clone('raindrops_featured_image_singular')) {
         $raindrops_featured_image_enable = false;
     }
     if (post_password_required() || !has_post_thumbnail() || false == $raindrops_featured_image_enable) {
         return;
     }
     /**
      * Show featured image
      *
      *
      *
      *
      */
     if (true == $raindrops_featured_image_full_size) {
         $thumb = get_the_post_thumbnail($post->ID, 'full');
     } else {
         $thumb = get_the_post_thumbnail($post->ID, 'single-post-thumbnail');
     }
     if (has_post_thumbnail() && isset($thumb) && $is_IE && $raindrops_use_featured_image_light_box == false) {
         /* IE8 img element has width height attribute. and style max-width and height auto makes conflict expand height */
         $thumbnailsrc = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumbnail');
         $thumbnailuri = esc_url($thumbnailsrc[0]);
         $thumbnailwidth = $thumbnailsrc[1];
         if ($thumbnailwidth > $content_width) {
             $thumbnailheight = $thumbnailsrc[2];
             $ratio = round(RAINDROPS_SINGLE_POST_THUMBNAIL_HEIGHT / RAINDROPS_SINGLE_POST_THUMBNAIL_WIDTH, 2);
             $ie_height = round($content_width * $ratio);
             $thumbnail_title = basename($thumbnailsrc[0]);
             $thumbnail_title = esc_attr($thumbnail_title);
             $size_attribute = image_hwstring($content_width, $ie_height);
             echo '<div class="single-post-thumbnail">';
             echo '<img src="' . $thumbnailuri . '" ' . $size_attribute . '" alt="' . $thumbnail_title . '" />';
             echo '</div>';
         } else {
             echo '<div class="single-post-thumbnail">';
             echo $thumb;
             echo '</div>';
         }
     } else {
         $raindrops_post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false, '');
         $flag = true;
         if ('w3standard' == raindrops_warehouse('raindrops_style_type') || false == $raindrops_use_featured_image_light_box) {
             //Sorry w3standard css can not use CSS3 then remove light box
             $flag = false;
         }
         if (!empty($thumb)) {
             echo '<div class="single-post-thumbnail">';
             if ($flag) {
                 echo '<a href="#raindrops-light-box" class="raindrops-light-box">';
             } else {
                 printf('<a href="%1$s">', get_attachment_link(get_post_thumbnail_id()));
             }
             echo $thumb;
             if ($flag) {
                 echo '</a>';
             }
             echo '</div>';
             /* for light box */
             if ($flag) {
                 echo '<div class="raindrops-lightbox-overlay" id="raindrops-light-box">';
                 echo '<a href="#page" class="lb-close">Close</a>';
                 echo '<img src="' . $raindrops_post_thumbnail_src[0] . '" alt="single post thumbnail" />';
                 echo '</div>';
             }
         }
     }
     /**
      * Add navigation link for post thumbnail
      *
      *
      *
      *
      */
     if (has_post_thumbnail() && true == $raindrops_use_featured_image_light_box) {
         $raindrops_html_piece = '<p style="text-align:center;font-size:small;"><a href="%1$s">%2$s</a></p>';
         printf($raindrops_html_piece, get_attachment_link(get_post_thumbnail_id()), esc_html__('Go to Attachment page', 'raindrops'));
     }
 }
开发者ID:TheRojam,项目名称:raindrops,代码行数:82,代码来源:functions.php


示例11: 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;
         case 'custom_link':
开发者ID:k2jysy,项目名称:wedev,代码行数:31,代码来源:vc_gallery.php


示例12: presscore_get_image_with_srcset

 function presscore_get_image_with_srcset($logo, $r_logo, $default, $custom = '', $class = '')
 {
     $logos = array('1x' => $logo, '2x' => $r_logo);
     $srcset = array();
     foreach ($logos as $xx => $_logo) {
         if (!empty($_logo)) {
             $srcset[] = "{$_logo[0]} {$xx}";
         }
     }
     $srcset = implode(', ', $srcset);
     $output = '<img class="' . esc_attr($class . ' preload-me') . '" srcset="' . esc_attr($srcset) . '" ' . image_hwstring($default[1], $default[2]) . $custom . ' />';
     return $output;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:13,代码来源:html-helpers.php


示例13: absint

if (trim($atts['height'])) {
    $atts['height'] = absint($atts['height']);
}
//title
$atts['title'] = esc_attr(trim($atts['title']));
//src
$atts['src'] = trim($atts['src']);
if (is_numeric($atts['src'])) {
    $image_size = apply_filters('wmhook_shortcode_' . $shortcode . '_image_size', 'full', $atts);
    $attr = array('title' => esc_attr(get_the_title(absint($atts['src']))));
    $atts['content'] = wp_get_attachment_image(absint($atts['src']), $image_size, false, $attr);
    if (trim(image_hwstring($atts['width'], $atts['height']))) {
        $atts['content'] = preg_replace('/(width|height)="\\d*"\\s/', '', $atts['content']);
        $atts['content'] = str_replace('<img ', '<img ' . trim(image_hwstring($atts['width'], $atts['height'])), $atts['content']);
    }
    if ($atts['margin']) {
        $atts['content'] = str_replace(' />', $atts['margin'] . ' />', $atts['content']);
    }
} else {
    $atts['content'] = '<img src="' . esc_url($atts['src']) . '" title="' . esc_attr($atts['title']) . '" alt="' . esc_attr($atts['title']) . '"' . trim(image_hwstring($atts['width'], $atts['height'])) . ' />';
}
//link
$atts['link'] = trim($atts['link']);
if ($atts['link']) {
    $atts['content'] = '<a href="' . esc_url($atts['link']) . '"' . $atts['attributes'] . '>' . $atts['content'] . '</a>';
}
//content filters
$atts['content'] = apply_filters('wmhook_shortcode_' . '_content', $atts['content'], $shortcode, $atts);
$atts['content'] = apply_filters('wmhook_shortcode_' . $shortcode . '_content', $atts['content'], $atts);
//Output
$output = '<div class="' . esc_attr($atts['class']) . '">' . $atts['content'] . '</div>';
开发者ID:pab44,项目名称:pab44,代码行数:31,代码来源:image.php


示例14: om_get_post_thumbnail

 function om_get_post_thumbnail($thumb_size, $single = true)
 {
     $html = '';
     $full_image = false;
     $post_id = get_the_ID();
     $post_thumbnail_id = get_post_thumbnail_id($post_id);
     if ($post_thumbnail_id) {
         $image = wp_get_attachment_image_src($post_thumbnail_id, 'full');
         if ($image) {
             $full_image = $image;
             list($src, $width, $height) = $image;
             $image_resized = om_img_resize($src, $thumb_size, false);
             if ($image_resized) {
                 list($src, $width, $height) = $image_resized;
             }
             $hwstring = image_hwstring($width, $height);
             $attachment = get_post($post_thumbnail_id);
             $default_attr = array('src' => $src, 'class' => "attachment-" . $thumb_size, 'alt' => trim(strip_tags(get_post_meta($post_thumbnail_id, '_wp_attachment_image_alt', true))));
             if (empty($default_attr['alt'])) {
                 $default_attr['alt'] = trim(strip_tags($attachment->post_excerpt));
             }
             // If not, Use the Caption
             if (empty($default_attr['alt'])) {
                 $default_attr['alt'] = trim(strip_tags($attachment->post_title));
             }
             // Finally, use the title
             if (get_option(OM_THEME_PREFIX . 'lazyload') == 'true') {
                 $default_attr['data-original'] = $default_attr['src'];
                 $default_attr['src'] = TEMPLATE_DIR_URI . '/img/e.png';
                 $default_attr['class'] .= ' lazyload';
             }
             $attr = $default_attr;
             $attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment);
             $attr = array_map('esc_attr', $attr);
             $html = rtrim("<img {$hwstring}");
             foreach ($attr as $name => $value) {
                 $html .= " {$name}=" . '"' . $value . '"';
             }
             $html .= ' />';
         }
     }
     if ($single) {
         return $html;
     } else {
         return array('html' => $html, 'full_image' => $full_image);
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:47,代码来源:images.php


示例15: parseTemplate

function parseTemplate($id, $type, $template, $orig_filename, $icon = "")
{
    DebugEcho("parseTemplate - before: {$template}");
    $size = 'medium';
    /* we check template for thumb, thumbnail, large, full and use that as
       size. If not found, we default to medium */
    if ($type == 'image') {
        $sizes = array('thumbnail', 'medium', 'large');
        $hwstrings = array();
        $widths = array();
        $heights = array();
        for ($i = 0; $i < count($sizes); $i++) {
            list($img_src[$i], $widths[$i], $heights[$i]) = image_downsize($id, $sizes[$i]);
            $hwstrings[$i] = image_hwstring($widths[$i], $heights[$i]);
        }
    }
    $attachment = get_post($id);
    $the_parent = get_post($attachment->post_parent);
    $uploadDir = wp_upload_dir();
    $fileName = basename($attachment->guid);
    $absFileName = $uploadDir['path'] . '/' . $fileName;
    $relFileName = str_replace(ABSPATH, '', $absFileName);
    $fileLink = wp_get_attachment_url($id);
    $pageLink = get_attachment_link($id);
    $template = str_replace('{TITLE}', $attachment->post_title, $template);
    $template = str_replace('{ID}', $id, $template);
    if ($type == 'image') {
        $template = str_replace('{THUMBNAIL}', $img_src[0], $template);
        $template = str_replace('{THUMB}', $img_src[0], $template);
        $template = str_replace('{MEDIUM}', $img_src[1], $template);
        $template = str_replace('{LARGE}', $img_src[2], $template);
        $template = str_replace('{THUMBWIDTH}', $widths[0] . 'px', $template);
        $template = str_replace('{THUMBHEIGHT}', $heights[0] . 'px', $template);
        $template = str_replace('{MEDIUMWIDTH}', $widths[1] . 'px', $template);
        $template = str_replace('{MEDIUMHEIGHT}', $heights[1] . 'px', $template);
        $template = str_replace('{LARGEWIDTH}', $widths[2] . 'px', $template);
        $template = str_replace('{LARGEHEIGHT}', $heights[2] . 'px', $template);
    }
    $template = str_replace('{FULL}', $fileLink, $template);
    $template = str_replace('{FILELINK}', $fileLink, $template);
    $template = str_replace('{PAGELINK}', $pageLink, $template);
    $template = str_replace('{FILENAME}', $orig_filename, $template);
    $template = str_replace('{IMAGE}', $fileLink, $template);
    $template = str_replace('{URL}', $fileLink, $template);
    $template = str_replace('{RELFILENAME}', $relFileName, $template);
    $template = str_replace('{POSTTITLE}', $the_parent->post_title, $template);
    $template = str_replace('{ICON}', $icon, $template);
    DebugEcho("parseTemplate - after: {$template}");
    return $template . '<br />';
}
开发者ID:donwea,项目名称:nhap.org,代码行数:50,代码来源:postie-functions.php


示例16: wp_get_attachment_image

function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false)
{
    $html = '';
    $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
    if ($image) {
        list($src, $width, $height) = $image;
        $hwstring = image_hwstring($width, $height);
        if (is_array($size)) {
            $size = join('x', $size);
        }
        $html = '<img src="' . attribute_escape($src) . '" ' . $hwstring . 'class="attachment-' . attribute_escape($size) . '" alt="" />';
    }
    return $html;
}
开发者ID:nurpax,项目名称:saastafi,代码行数:14,代码来源:media.php


示例17: projectTheme_wp_get_attachment_image

function projectTheme_wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '')
{
    $html = '';
    $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
    if ($image) {
        list($src, $width, $height) = $image;
        $hwstring = image_hwstring($width, $height);
        if (is_array($size)) {
            $size = join('x', $size);
        }
        $attachment =& get_post($attachment_id);
        $default_attr = array('src' => $src, 'class' => "attachment-{$size}", 'alt' => trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true))), 'title' => trim(strip_tags($attachment->post_title)));
        if (empty($default_attr['alt'])) {
            $default_attr['alt'] = trim(strip_tags($attachment->post_excerpt));
        }
        // If not, Use the Caption
        if (empty($default_attr['alt'])) {
            $default_attr['alt'] = trim(strip_tags($attachment->post_title));
        }
        // Finally, use the title
        $attr = wp_parse_args($attr, $default_attr);
        $attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment);
        $attr = array_map('esc_attr', $attr);
        $html = rtrim("<img {$hwstring}");
        $html = $attr['src'];
    }
    return $html;
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:28,代码来源:functions.php


示例18: get_image_html

 /**
  * Render the image html output.
  *
  * @param array $instance
  * @param bool $include_link will only render the link if this is set to true. Otherwise link is ignored.
  * @return string image html
  */
 private function get_image_html($instance, $include_link = true)
 {
     // Backwards compatible image display.
     if ($instance['attachment_id'] == 0 && $instance['image'] > 0) {
         $instance['attachment_id'] = $instance['image'];
     }
     $output = '';
     if ($include_link && !empty($instance['link'])) {
         $attr = array('href' => $instance['link'], 'target' => $instance['linktarget'], 'class' => $this->widget_options['classname'] . '-image-link', 'title' => !empty($instance['alt']) ? $instance['alt'] : $instance['title']);
         $attr = apply_filters('image_widget_link_attributes', $attr, $instance);
         $attr = array_map('esc_attr', $attr);
         $output = '<a';
         foreach ($attr as $name => $value) {
             $output .= sprintf(' %s="%s"', $name, $value);
         }
         $output .= '>';
     }
     $size = $this->get_image_size($instance);
     if (is_array($size)) {
         $instance['width'] = $size[0];
         $instance['height'] = $size[1];
     } elseif (!empty($instance['attachment_id'])) {
         //$instance['width'] = $instance['height'] = 0;
         $image_details = wp_get_attachment_image_src($instance['attachment_id'], $size);
         if ($image_details) {
             $instance['imageurl'] = $image_details[0];
             $instance['width'] = $image_details[1];
             $instance['height'] = $image_details[2];
         }
     }
     $instance['width'] = abs($instance['width']);
     $instance['height'] = abs($instance['height']);
     $attr = array();
     $attr['alt'] = $instance['title'];
     if (is_array($size)) {
         $attr['class'] = 'attachment-' . join('x', $size);
     } else {
         $attr['class'] = 'attachment-' . $size;
     }
     $attr['style'] = '';
     if (!empty($instance['width'])) {
         $attr['style'] .= "max-width: {$instance['width']}px;";
     }
     if (!empty($instance['height'])) {
         $attr['style'] .= "max-height: {$instance['height']}px;";
     }
     if (!empty($instance['align']) && $instance['align'] != 'none') {
         $attr['class'] .= " align{$instance['align']}";
     }
     $attr = apply_filters('image_widget_image_attributes', $attr, $instance);
     // If there is an imageurl, use it to render the image. Eventually we should kill this and simply rely on attachment_ids.
     if (!empty($instance['imageurl'])) {
         // If all we have is an image src url we can still render an image.
         $attr['src'] = $instance['imageurl'];
         $attr = array_map('esc_attr', $attr);
         $hwstring = image_hwstring($instance['width'], $instance['height']);
         $output .= rtrim("<img {$hwstring}");
         foreach ($attr as $name => $value) {
             $output .= sprintf(' %s="%s"', $name, $value);
         }
         $output .= ' />';
     } elseif (abs($instance['attachment_id']) > 0) {
         $output .= wp_get_attachment_image($instance['attachment_id'], $size, false, $attr);
     }
     if ($include_link && !empty($instance['link'])) {
         $output .= '</a>';
     }
     return $output;
 }
开发者ID:paarthd,项目名称:gslvpa,代码行数:76,代码来源:image-widget.php


示例19: create_image_tag

 /**
  * render image tag
  *
  * @param int $attachment_id post id of the image
  * @since 1.6.10
  */
 public function create_image_tag($attachment_id)
 {
     $image = wp_get_attachment_image_src($attachment_id, 'full');
     if ($image) {
         list($src, $width, $height) = $image;
         $hwstring = image_hwstring($width, $height);
         $attachment = get_post($attachment_id);
         $alt = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
         $title = trim(strip_tags($attachment->post_title));
         // Finally, use t 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP image_link_input_fields函数代码示例发布时间:2022-05-15
下一篇:
PHP image_get_intermediate_size函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap