/**
  * Image
  *
  * Helps generate image HTML.
  *
  * @access      public
  * @param       string    the name of the image
  * @param       string    optional, module name
  * @param       string    optional, extra attributes
  * @return      string    HTML code for image asset
  */
 public function image($asset_name, $module_name = '', $attributes = array(), $location_type = '')
 {
     $asset_name = @(string) $asset_name;
     $attributes = html_attr($attributes);
     // No alternative text given? Use the filename, better than nothing!
     if (!html_attr_has($attributes, 'alt')) {
         list($alt) = explode('.', $asset_name);
         // TODO: Improve this for URL type asset name.
         if (stripos($asset_name, 'data:') !== 0) {
             $attributes = html_attr_set($attributes, 'alt', $alt);
         }
     }
     $optional = $location_type && substr($location_type, -1) === '?' and ($location_type = substr($location_type, 0, -1)) === 'path';
     $location_type = 'image_' . (($optional or in_array($location_type, array('url', 'path'))) ? $location_type : 'path');
     $location = $this->{$location_type}($asset_name, $module_name);
     if ($optional && !is_file(FCPATH . ltrim($location, '/'))) {
         return '';
     }
     return '<img src="' . $location . '"' . $attributes . ' />';
 }
 /**
  * Sets the value of the attribute
  *
  * @param string|array $attributes Array of attributes or HTML attribute string
  * @param string $name  Attribute name
  * @param string $value Attribute value (will be set to $name if omitted)
  *
  * @return string A string containing result attributes
  *
  * @deprecated Use html_attr_set().
  */
 function set_attribute($attributes, $name, $value = null)
 {
     return html_attr_set($attributes, $name, $value);
 }