Thumb::tag PHP Method

tag() public method

Generates and returns the full html tag for the thumbnail
public tag ( array $attr = [] ) : string
$attr array An optional array of attributes, which should be added to the image tag
return string
    public function tag($attr = array())
    {
        // don't return the tag if the url is not available
        if (!$this->result->url()) {
            return false;
        }
        return html::img($this->result->url(), array_merge(array('alt' => isset($this->options['alt']) ? $this->options['alt'] : ' ', 'class' => isset($this->options['class']) ? $this->options['class'] : null), $attr));
    }

Usage Example

Example #1
0
/**
 * Created by PhpStorm.
 * User: Amedora
 * Date: 2/27/15
 * Time: 5:39 AM
 */
function Thumb($obj, $options = array(), $tag = true)
{
    $thumb = new Thumb($obj, $options);
    return $tag ? $thumb->tag() : $thumb->url();
}