예제 #1
0
 /**
  * Picture responsive
  *
  * Extends from HtmlHelper:image()
  *
  * @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.
  *    => 'responsive' : add a class 'img-responsive' if true, default to false
  *    => 'type' => rounded, circle, thumbnail
  * @return string End tag header
  */
 public function image($path, array $options = [])
 {
     $options = Hash::merge($this->config('image'), $options);
     if ($options['responsive']) {
         if (isset($options['class'])) {
             $options['class'] = 'img-responsive ' . $options['class'];
         }
         $options['class'] = 'img-responsive';
     }
     if (isset($options['type']) && in_array($options['type'], $this->_types['image'])) {
         $options['class'] .= ' img-' . $options['type'];
     }
     return parent::image($path, $options);
 }