/** * Extended to pass URLs through Laravel. * * @internal * @param array $matches * @return string * @uses Laravel\URL::to_asset() */ function _doImages_inline_callback($matches) { $alt_text = $matches[2]; $url = $matches[3] == '' ? $matches[4] : $matches[3]; $title = isset($matches[7]) ? $matches[7] : null; $alt_text = $this->encodeAttribute($alt_text); $url = $this->encodeAttribute($url); // BEGIN: Modification to pass URLs through Laravel if ($url[0] !== '#' and is_null(parse_url($url, PHP_URL_SCHEME))) { $url = \Laravel\URL::to_asset($url); } // END $result = "<img src=\"{$url}\" alt=\"{$alt_text}\""; if (isset($title)) { $title = $this->encodeAttribute($title); $result .= " title=\"{$title}\""; # $title already quoted } $result .= $this->empty_element_suffix; return $this->hashPart($result); }
/** * Create a HTML image input element. * * The URL::to_asset method will be called on the given URL. * * <code> * // Create an image input element * echo Form::image('img/submit.png'); * </code> * * @param string $url * @param array $attributes * @return string */ public static function image($url, $name = null, $attributes = array()) { $attributes['src'] = URL::to_asset($url); return static::input('image', $name, null, $attributes); }
public static function image($url, $alt = '', $attributes = array()) { $attributes['alt'] = $alt; return '<img src="' . URL::to_asset($url) . '"' . static::attributes($attributes) . '>'; }