@param string|null $src
@param string|null $alt

@return \Spatie\Html\Elements\Img
337974
public function img($src = null, $alt = null)
    {
        return Img::create()
            ->attributeIf($src, 'src', $src)
            ->attributeIf($alt, 'alt', $alt);
    }
429970
public static function imageRounded($src, $alt = '', $htmlOptions = array())
    {
        $htmlOptions['type'] = self::IMAGE_TYPE_ROUNDED;
        return self::image($src, $alt, $htmlOptions);
    }
1096798
public function image($url, $alt = null, $options = [])
    {
        $options['alt'] = $alt;

        return '<img src="'.$this->_generator->asset($url).'"'.self::attributes($options).'>';
    }
1340844
private function renderImageAsHtml($src, $alt, $attributes = '')
    {
        /** @var GenerateHtmlEvent $imageEvent */
        $imageEvent = $this->eventDispatcher->dispatch(
            ContaoEvents::IMAGE_GET_HTML,
            new GenerateHtmlEvent($src, $alt, $attributes)
        );

        return $imageEvent->getHtml();
    }
1028239
def image(link, title, alt_text)
      # add the querystring to the image
      if @image_parameters.present?
        prefix = link.include?('?') ? '&' : '?'
        link += "#{prefix}#{@image_parameters.to_query}"
      end
      # return a content tag
      content_tag(:img, nil, src: link.to_s, alt: alt_text, title: title)
    end
611367
public function url($return = null, $altRealm = null)
    {
        $useHttps = !empty($_SERVER['HTTPS']) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https');
        if (!is_null($return)) {
            if (!$this->validateUrl($return)) {
                throw new Exception('The return URL must be a valid URL with a URI Scheme or http or https.');
            }
        }
        else {
            if($altRealm == null)
                $return = ($useHttps ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
            else
                $return = $altRealm . $_SERVER['SCRIPT_NAME'];
        }

        $params = array(
            'openid.ns'         => 'http://specs.openid.net/auth/2.0',
            'openid.mode'       => 'checkid_setup',
            'openid.return_to'  => $return,
            'openid.realm'      => $altRealm != null ? $altRealm : (($useHttps ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']),
            'openid.identity'   => 'http://specs.openid.net/auth/2.0/identifier_select',
            'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select',
        );

        return self::$openId . '?' . http_build_query($params);
    }
1022389
public function getThumbImage($alias, $options=[])
    {
        $url = $this->getThumbUrl($alias);

        if (empty($url)) {
            return '';
        }

        if (empty($options['alt'])) {
            $options['alt'] = $this->alt;
        }

        return Html::img($url, $options);
    }
919720
private function build_src( $src ) {
		if ( ! preg_match( '/^(https?:)?\/\//u', $src ) ) {
			// O.K. This is a library in WPametu!
			$src = trailingslashit( $this->get_root_uri() ) . ltrim( $src, '/' );
		}

		return $src;
	}
858707
public function img($attributes = null)
    {
        if ($image = $this->transformed) {
            if ($image && isset($image['url'])) {
                $lazyLoad = false;
                if (isset($attributes['lazyLoad'])) {
                    $lazyLoad = $attributes['lazyLoad'];
                    unset($attributes['lazyLoad']); // unset to remove it from the html output
                }
                $tagAttributes = $this->getTagAttributes($attributes);

                return Template::raw('<img ' . ($lazyLoad ? $this->lazyLoadPrefix : '') . 'src="' . $image['url'] . '" ' . $tagAttributes . ' />');
            }
        }

        return null;
    }
644740
public function highlight($src)
    {
        $this->string($src);
        $this->init();
        $this->main();
        return $this->tagged();
    }
222812
public static function phpCode($src)
    {
        // Whitespaces left and right from this signs can be ignored
        static $IW = array(
            T_CONCAT_EQUAL, // .=
            T_DOUBLE_ARROW, // =>
            T_BOOLEAN_AND, // &&
            T_BOOLEAN_OR, // ||
            T_IS_EQUAL, // ==
            T_IS_NOT_EQUAL, // != or <>
            T_IS_SMALLER_OR_EQUAL, // <=
            T_IS_GREATER_OR_EQUAL, // >=
            T_INC, // ++
            T_DEC, // --
            T_PLUS_EQUAL, // +=
            T_MINUS_EQUAL, // -=
            T_MUL_EQUAL, // *=
            T_DIV_EQUAL, // /=
            T_IS_IDENTICAL, // ===
            T_IS_NOT_IDENTICAL, // !==
            T_DOUBLE_COLON, // ::
            T_PAAMAYIM_NEKUDOTAYIM, // ::
            T_OBJECT_OPERATOR, // ->
            T_DOLLAR_OPEN_CURLY_BRACES, // ${
            T_AND_EQUAL, // &=
            T_MOD_EQUAL, // %=
            T_XOR_EQUAL, // ^=
            T_OR_EQUAL, // |=
            T_SL, // <<
            T_SR, // >>
            T_SL_EQUAL, // <<=
            T_SR_EQUAL, // >>=
        );

        if (!$src) {
            return false;
        }

        if (is_file($src) && (!$src = file_get_contents($src))) {
            return false;
        }

        $tokens = token_get_all($src);

        $new = '';
        $c = \count($tokens);
        $iw = false; // ignore whitespace
        $ih = false; // in HEREDOC
        $ls = ''; // last sign
        $ot = null; // open tag
        for ($i = 0; $i < $c; $i++) {
            $token = $tokens[$i];
            if (\is_array($token)) {
                list($tn, $ts) = $token; // tokens: number, string, line
                $tname = token_name($tn);
                if ($tn === T_INLINE_HTML) {
                    $new .= $ts;
                    $iw = false;
                } else {
                    if ($tn === T_OPEN_TAG) {
                        if (strpos($ts, ' ') || strpos($ts, "\n") || strpos($ts, "\t") || strpos($ts, "\r")) {
                            $ts = rtrim($ts);
                        }
                        $ts .= ' ';
                        $new .= $ts;
                        $ot = T_OPEN_TAG;
                        $iw = true;
                    } elseif ($tn === T_OPEN_TAG_WITH_ECHO) {
                        $new .= $ts;
                        $ot = T_OPEN_TAG_WITH_ECHO;
                        $iw = true;
                    } elseif ($tn === T_CLOSE_TAG) {
                        if ($ot === T_OPEN_TAG_WITH_ECHO) {
                            $new = rtrim($new, '; ');
                        } else {
                            $ts = ' ' . $ts;
                        }
                        $new .= $ts;
                        $ot = null;
                        $iw = false;
                    } elseif (\in_array($tn, $IW, true)) {
                        $new .= $ts;
                        $iw = true;
                    } elseif ($tn === T_CONSTANT_ENCAPSED_STRING || $tn === T_ENCAPSED_AND_WHITESPACE) {
                        if ($ts[0] === '"') {
                            $ts = addcslashes($ts, "\n\t\r");
                        }
                        $new .= $ts;
                        $iw = true;
                    } elseif ($tn === T_WHITESPACE) {
                        $nt = @$tokens[$i + 1];
                        if (!$iw && (!\is_string($nt) || $nt === '$') && !\in_array($nt[0], $IW)) {
                            $new .= " ";
                        }
                        $iw = false;
                    } elseif ($tn === T_START_HEREDOC) {
                        $new .= "<<<S\n";
                        $iw = false;
                        $ih = true; // in HEREDOC
                    } elseif ($tn === T_END_HEREDOC) {
                        $new .= "S;\n";
                        $iw = true;
                        $ih = false; // in HEREDOC
                        for ($j = $i + 1; $j < $c; $j++) {
                            if (\is_string($tokens[$j]) && $tokens[$j] === ';') {
                                $i = $j;
                                break;
                            }
                            if ($tokens[$j][0] === T_CLOSE_TAG) {
                                break;
                            }
                        }
                    } elseif ($tn === T_COMMENT || $tn === T_DOC_COMMENT) {
                        $iw = true;
                    } else {
                        if (!$ih) {
                            $ts = strtolower($ts);
                        }
                        $new .= $ts;
                        $iw = false;
                    }
                }
                $ls = '';
            } else {
                if (($token !== ';' && $token !== ':') || $ls !== $token) {
                    $new .= $token;
                    $ls = $token;
                }
                $iw = true;
            }
        }

        return $new;
    }
554316
protected function _img($str) {
		return preg_replace_callback(
			'/!(?:\[(.+?)\])?\h*\(<?(.*?)>?(?:\h*"(.*?)"\h*)?\)/',
			function($expr) {
				return '<img src="'.$expr[2].'"'.
					(empty($expr[1])?
						'':
						(' alt="'.$this->esc($expr[1]).'"')).
					(empty($expr[3])?
						'':
						(' title="'.$this->esc($expr[3]).'"')).' />';
			},
			$str
		);
	}
432070
function define( $c, $alt = '' ){
		if( ! is_string($c) ){
			trigger_error("symbol $c must be a string", E_USER_WARNING );
			return null;
		}
		if( defined($c) ){
			trigger_error("Conflict on symbol $c, already defined", E_USER_ERROR );
		}
		define( $c, ++ $this->i );
		$this->names[ $this->i ] = $alt ? $alt : $c;
		return $this->i;
	}
500296
public function load($src = null, $dir = null)
    {
        if (isset($src)) {
            $this->setSource($src, $dir);
        }

        $this->loadImageDetails();

        if ($this->fileType === IMG_WEBP) {
            $this->image = imagecreatefromwebp($this->pathToImage);
        } else {
            $imageAsString = file_get_contents($this->pathToImage);
            $this->image = imagecreatefromstring($imageAsString);
        }
        if ($this->image === false) {
            throw new Exception("Could not load image.");
        }

        /* Removed v0.7.7
        if (image_type_to_mime_type($this->fileType) == 'image/png') {
            $type = $this->getPngType();
            $hasFewColors = imagecolorstotal($this->image);

            if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) {
                if ($this->verbose) {
                    $this->log("Handle this image as a palette image.");
                }
                $this->palette = true;
            }
        }
        */

        if ($this->verbose) {
            $this->log("### Image successfully loaded from file.");
            $this->log(" imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false'));
            $this->log(" imagecolorstotal() : " . imagecolorstotal($this->image));
            $this->log(" Number of colors in image = " . $this->colorsTotal($this->image));
            $index = imagecolortransparent($this->image);
            $this->log(" Detected transparent color = " . ($index >= 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index");
        }

        return $this;
    }
663598
public function createImage($src, $alt = null)
    {
        return $this->image = new Card\Image($src, $alt);
    }
1353266
public function img($pipeline, $src, array $options = [])
    {
        return \yii\helpers\Html::img($this->url($pipeline, $src), $options);
    }
760026
public static function img($attr = null)
    {
        if (is_string($attr)) {
            $attr = array('src' => $attr);
        }

        return self::tag('img', $attr + array('alt' => ''), null, array_merge(self::$common_attrib,
            array('src','alt','width','height','border','usemap','onclick','onerror','onload')));
    }