当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlHelper::image方法代码示例

本文整理汇总了PHP中HtmlHelper::image方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::image方法的具体用法?PHP HtmlHelper::image怎么用?PHP HtmlHelper::image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlHelper的用法示例。


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

示例1: flag

 /**
  * Return language flag image url
  *
  * @param int $id
  * @param mixed $attrs Html attributes of the flag image
  */
 function flag($id = null, $attrs = array())
 {
     if (empty($id)) {
         $id = $this->langID();
     }
     //if
     $objLang = new Language();
     $lang = $objLang->read('flag', $id);
     return $this->Html->image('/img/flags/' . $lang['Language']['flag'], $attrs);
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:16,代码来源:LanguageHelper.php

示例2: image

 public function image($path, $options = array())
 {
     if (empty($path)) {
         $path = 'no_image.png';
     } else {
         if (isset($options['section'])) {
             switch ($options['section']) {
                 case 'UserProfile':
                     $path = Configure::read('ImagePath.UserProfile') . $path;
                     break;
                 case 'AdvisorProfile':
                     $path = Configure::read('ImagePath.AdvisorProfile') . $path;
                     break;
                 case 'temp':
                     $path = Configure::read('ImagePath.temp') . $path;
                     break;
                 case 'Job':
                     $path = Configure::read('ImagePath.Job') . $path;
                     break;
                 case 'BusinessField':
                     $path = Configure::read('ImagePath.BusinessField') . $path;
                     break;
             }
         }
     }
     return parent::image($path, $options);
 }
开发者ID:sonnt1991,项目名称:Goikenban,代码行数:27,代码来源:CustomHtmlHelper.php

示例3: image

 /**
  *
  * @param string $path
  * @param array  $options
  * @return @return string completed img tag
  */
 public function image($path, $options = array())
 {
     if (preg_match('!^http://a[0-9]+\\.twimg\\.com/!', $path) && env('HTTPS')) {
         $path = preg_replace('!^http://a[0-9]+\\.twimg\\.com/!', 'https://s3.amazonaws.com/twitter_production/', $path);
     }
     return $this->Html->image($path, $options);
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:13,代码来源:twitter.php

示例4: image

 /**
  * Adds support for lazy loading images
  * Set "lazy" => true in $options array to activate
  * @param string $path
  * @param array $options
  * @return string
  */
 public function image($path, $options = array())
 {
     $image = parent::image($path, $options);
     // Special options for lazy loading
     if (isset($options['lazy']) && $options['lazy'] === true) {
         // Unset useless lazy options
         unset($options['lazy']);
         // Add "lazy" to class attribute
         if (isset($options['class'])) {
             $classes = explode(' ', $options['class']);
             $classes[] = 'lazy';
             $options['class'] = implode(' ', $classes);
         } else {
             $options['class'] = 'lazy';
         }
         // Set fake image if no image set
         if (!$path) {
             $path = '/img/';
         }
         // Store original path in data attribute
         $options['data-original'] = $path;
         // Set path to transparent gif
         $path = 'transparent.gif';
         // Create <noscript> for SEO purposes
         $noscript = sprintf("<noscript>%s</noscript>", $image);
         // Concatenate both
         $image = parent::image($path, $options) . $noscript;
     }
     return $image;
 }
开发者ID:mathg,项目名称:skinsound,代码行数:37,代码来源:MyHtmlHelper.php

示例5: thumbnail

 /**
  * Creates a formatted IMG element for preview images.
  *
  * @see HtmlHelper::image()
  * @param string $path Image Path
  * @param array $options Options list
  * @return string Completed img tag
  */
 public function thumbnail($path, $options = array())
 {
     $class = $this->Theme->getCssClass('thumbnailClass');
     if (empty($options['class'])) {
         $options['class'] = $class;
     }
     return parent::image($path, $options);
 }
开发者ID:saydulk,项目名称:croogo,代码行数:16,代码来源:CroogoHtmlHelper.php

示例6: thumbnail

 /**
  * Creates a formatted IMG element for preview images.
  *
  * @see HtmlHelper::image()
  * @param string $path Image Path
  * @param array $options Options list
  * @return string Completed img tag
  */
 public function thumbnail($path, $options = array())
 {
     $class = $this->_View->viewVars['themeSettings']['css']['thumbnailClass'];
     if (empty($options['class'])) {
         $options['class'] = $class;
     }
     return parent::image($path, $options);
 }
开发者ID:ahmadhasankhan,项目名称:croogo,代码行数:16,代码来源:CroogoHtmlHelper.php

示例7: image

 public function image($path, $options = array())
 {
     if ($this->settings['altEqualTitle']) {
         if (isset($options['alt']) && !isset($options['title'])) {
             $options['title'] = $options['alt'];
         } elseif (isset($options['title']) && !isset($options['alt'])) {
             $options['alt'] = $options['title'];
         }
     }
     return parent::image($path, $options);
 }
开发者ID:hiromi2424,项目名称:ninja,代码行数:11,代码来源:ninja_html.php

示例8: image

 /**
  * Creates a formatted IMG element.
  *
  * This method will set an empty alt attribute if one is not supplied.
  *
  * ### Usage:
  *
  * Create a regular image:
  *
  * `echo $this->Html->image('cake_icon.png', array('alt' => 'CakePHP'));`
  *
  * Create an image link:
  *
  * `echo $this->Html->image('cake_icon.png', array('alt' => 'CakePHP', 'url' => 'http://cakephp.org'));`
  *
  * ### Options:
  *
  * - `url` If provided an image link will be generated and the link will point at
  *   `$options['url']`.
  * - `fullBase` If true the src attribute will get a full address for the image file.
  * - `plugin` False value will prevent parsing path as a plugin
  * - `data-src` For holder.js options. If `$path` is not empty, then unset `$options['data-src']`.
  *
  * @param string $path Path to the image file, relative to the app/webroot/img/ directory.
  * @param array $options Array of HTML attributes. See above for special options.
  * @return string completed img tag
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::image
  */
 public function image($path, $options = array())
 {
     if (empty($path)) {
         $path = '/';
     } else {
         if (isset($options['data-src'])) {
             unset($options['data-src']);
         }
     }
     return parent::image($path, $options);
 }
开发者ID:hiryu85,项目名称:cakephp-boost-cake,代码行数:39,代码来源:BoostCakeHtmlHelper.php

示例9: image

 /**
  * image
  * With auto sizing/formatting built in.
  * @param string $path
  * @param array $ops
  * @return string
  */
 public function image($path, $opts = array())
 {
     if (isset($opts['w']) || isset($opts['h'])) {
         $path = $this->Image->make($path, $opts);
         foreach ($this->Image->phpThumb as $key => $val) {
             unset($opts[$key]);
         }
     }
     $base = substr(Router::url('/'), 0, -1);
     if (!empty($base) && substr($path, 0, strlen($base)) == $base) {
         $path = substr($path, strlen($base));
     }
     return parent::image($path, $opts);
 }
开发者ID:shama,项目名称:oven,代码行数:21,代码来源:OvenHtmlHelper.php

示例10: get_markup

 /**
  * (non-PHPdoc)
  * @see GalleryHelper::get_markup()
  */
 public function get_markup()
 {
     $toret = '';
     if (count($this->images) > 0) {
         $subs = new SubstitutionTemplate();
         $subs->set_tpl($this->tpl)->set_markup('prev', HtmlHelper::anchor('javascript:;', '&lt;', array('class' => 'prev control')))->set_markup('next', HtmlHelper::anchor('javascript:;', '&gt;', array('class' => 'next control')));
         ThemeHelpers::load_js('minigallery-thumbs-link-to-big');
         ThemeHelpers::load_css('jquery-fancybox');
         foreach ($this->images as $index => $image) {
             $image_big = wp_get_attachment_image_src($this->get_image_id($index), $this->media_dimension_big);
             $image_small = wp_get_attachment_image_src($this->get_image_id($index), $this->media_dimension);
             $toret .= HtmlHelper::anchor($image_big[0], HtmlHelper::image($this->get_image_src($index), array('alt' => $this->get_image_alt($index), 'title' => $this->get_image_description($index), 'data-caption' => $this->get_image_caption($index))), array('class' => 'fancybox', 'rel' => 'group', 'title' => $this->get_image_caption($index)));
         }
         $toret = $subs->set_markup('list', $toret)->replace_markup();
     }
     return $toret;
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:21,代码来源:MinigalleryThumbsLinkToBig.class.php

示例11: image

 /**
  * Creates a formatted IMG element.
  * Allow calling directly with media data
  *
  * @param string $path Path to the image file, relative to the app/webroot/img/ directory.
  * @param array	$options Array of HTML attributes.
  * @return string
  */
 public function image($path, $options = array())
 {
     if (is_array($path)) {
         $data = $path;
         $path = $this->imageUrl($data, $options);
         if (is_string($options)) {
             $args = func_get_args();
             if (!empty($args[2])) {
                 $options = $args[2];
             } else {
                 $options = array();
             }
         } else {
             unset($options['size']);
         }
         $options = $this->imageAttributes($data, $options);
     }
     return parent::image($path, $options);
 }
开发者ID:razzman,项目名称:mi,代码行数:27,代码来源:MiHtmlHelper.php

示例12: post_thumbnail_html_callback

 /**
  * Callback for 'post_thumbnail_html' hook.
  * Changes the html markup if the post thumbnail is not set
  * @param string $html
  * @param unknown_type $post_id
  * @param unknown_type $post_thumbnail_id
  * @param unknown_type $size
  * @param unknown_type $attr
  */
 public function post_thumbnail_html_callback($html, $post_id, $post_thumbnail_id, $size, $attr)
 {
     if ($post_thumbnail_id == -1) {
         $sizes = self::get_all_image_sizes();
         if (empty($size) || !in_array($size, array_keys($sizes))) {
             $size = 'medium';
         }
         return HtmlHelper::image(admin_url('admin-ajax.php') . '?' . build_query(array('action' => 'placeholder', 'w' => $sizes[$size]['width'], 'h' => $sizes[$size]['height']), array('alt' => __('Placeholder post thumbnail'), 'width' => $sizes[$size]['width'], 'height' => $sizes[$size]['height'])));
     }
     return $html;
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:20,代码来源:ImageGenerator.class.php

示例13: iconlink

 function iconlink($icon, $title, $url = null, $htmlAttributes = array(), $confirmMessage = false)
 {
     $img = parent::image("/authake/img/icons/{$icon}.png", array('title' => $title));
     return parent::link($img, $url, am($htmlAttributes, array('escape' => false)), $confirmMessage, false);
 }
开发者ID:nchankov,项目名称:authake,代码行数:5,代码来源:htmlbis.php

示例14: get_markup

 /**
  * Retrieves the markup for this minigallery
  * @return the markup for the minigallery
  */
 public function get_markup()
 {
     $toret = '';
     if (count($this->images) > 0) {
         $this->load_assets();
         $thumb_list = '';
         foreach ($this->images as $k => $image) {
             if ($k % $this->thumb_list_config['number'] == 0 && $k > 0) {
                 $thumb_list .= $this->thumb_list_config['separator']['close'] . $this->thumb_list_config['separator']['open'];
             }
             // $src = $this->get_image_src($k);
             $big_img_link = wp_get_attachment_image_src($this->get_image_id($k), $this->sizes['big']);
             // vd($big_img_link);
             $small_img_link = wp_get_attachment_image_src($this->get_image_id($k), $this->sizes['small']);
             $thumb_list .= HtmlHelper::anchor($big_img_link[0], HtmlHelper::image($small_img_link[0], array('class' => 'image')), array('class' => 'thumb-link', 'data-caption' => $this->get_image_caption($k)));
         }
         if (!$this->unid) {
             $this->calculate_unique();
         }
         $this->static_markup['minigallery-id'] = $this->unid;
         $this->static_markup['thumb-list'] = $this->thumb_list_config['separator']['open'] . $thumb_list . $this->thumb_list_config['separator']['close'];
         $toret = str_replace(array_map(create_function('$k', 'return "%".$k."%";'), array_keys($this->static_markup)), array_values($this->static_markup), $this->tpl);
     }
     return $toret;
 }
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:29,代码来源:MinigalleryBigImageWithThumbs.class.php

示例15: image

 /**
  * This function overrides the HtmlHelper image() function.
  * It provides:
  *
  *  - an automatic image resize if a 'maxWidth' and/or 'maxHeight' value are given in the options
  *    the function tries to determine the physical height and width of the image, in order to prevent enlarging
  *    an image if the given maxWidth and/or maxHeight are larger the image dimensions.
  *
  *  - the replacement of the image by a alternative image set as 'not_found' in the options
  *    if the $path does not point to an existing image
  *
  * @param $path
  * @param $options
  */
 function image($path, $options = array())
 {
     /*
      * Parse $path to determine if it is a path in a plugin or not
      */
     $url = Router::parse($path);
     $plugin = empty($url['plugin']) ? null : $url['plugin'];
     /*
      * If the options contains an image path to replace a missing image
      * -> checks if the requested image exists
      */
     $file_path = '';
     $pic_path = '';
     if (isset($options) && is_array($options)) {
         if (isset($plugin)) {
             $plugin_path = App::pluginPath($plugin);
             $subpath = str_replace('/' . $plugin, '', $path);
             if (file_exists($plugin_path . 'webroot/' . $subpath) && is_file($plugin_path . 'webroot/' . $subpath)) {
                 $file_path = $plugin_path . 'webroot/' . $subpath;
             } elseif (isset($options['not_found'])) {
                 $path = $options['not_found'];
             }
         } else {
             if (file_exists(WWW_ROOT . 'img/' . $path) && is_file(WWW_ROOT . 'img/' . $path)) {
                 $file_path = WWW_ROOT . 'img/' . $path;
             } elseif (file_exists(WWW_ROOT . $path) && is_file(WWW_ROOT . $path)) {
                 $file_path = WWW_ROOT . $path;
             } elseif (isset($options['not_found'])) {
                 $path = $options['not_found'];
             }
         }
     }
     if (strlen($file_path) > 0) {
         if (file_exists($file_path)) {
             $imgInfos = getimagesize($file_path);
         }
         $width = $imgInfos[0];
         $height = $imgInfos[1];
         if (isset($options['maxWidth']) && isset($options['maxHeight'])) {
             if ($options['maxWidth'] < $width) {
                 $options['width'] = $options['maxWidth'];
                 $newHeight = $options['width'] * $height / $width;
                 if ($options['maxHeight'] < $newHeight) {
                     $options['height'] = $options['maxHeight'];
                     unset($options['width']);
                 }
             } else {
                 if ($options['maxHeight'] < $height) {
                     $options['height'] = $options['maxHeight'];
                 }
             }
         } elseif (isset($options['maxWidth'])) {
             if ($options['maxWidth'] < $width) {
                 $options['width'] = $options['maxWidth'];
             }
         } elseif (isset($options['maxHeight'])) {
             if ($options['maxHeight'] < $height) {
                 $options['height'] = $options['maxHeight'];
             }
         }
         if (isset($options['maxHeight'])) {
             unset($options['maxHeight']);
         }
         if (isset($options['maxWidth'])) {
             unset($options['maxWidth']);
         }
     }
     return parent::image($path, $options);
 }
开发者ID:shashin62,项目名称:abc_audit,代码行数:83,代码来源:alaxos_html.php


注:本文中的HtmlHelper::image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。