get the html photo element

@param array $attributes
@param string $type  original or thumbnails key
@param boolean $onlyUrl
@param string|null $modelSlug
@param string|null $relation
@return string
511120
public function getPhoto($attributes = [], $type='original', $onlyUrl = false, $modelSlug = null, $relation = null)
    {
        $this->setAttributes($modelSlug,'photo');
        $photo = $this->getFile();

        if( ! is_null($photo)) {
            $src = $this->getFileSrc($photo, $relation, $type);
        } else {
            $type = $type === 'original' ? 'biggest' : $type;
            $src = config("{$this->module}.{$this->modelSlug}.default_img_path") . "/{$type}.jpg";
        }

        $attr = $this->getHTMLAttributes($attributes);
        return $onlyUrl ? asset($src) : '<img src="'.asset($src).'" '.$attr.'>';
    }
1268647
public static function getFavicon($url, $attributes = [])
    {
        $attr = trim(self::arrayToString($attributes));

        if (!empty($attr)) {
            $attr = " $attr";
        }

        return sprintf(
            '<img src="https://www.google.com/s2/favicons?domain=%s"%s/>',
            urlencode($url),
            $attr
        );
    }
85342
public static function getFromSpriteO( StaticImageDto $image, array $attributes = [] ): Html
	{
		return self::getFromSprite($image->sprite, $image->x, $image->y, $image->w, $image->h, $attributes);
	}
1259750
public function getImageBlob($type = self::IMAGE_JPG, $getHtmlTag = false)
    {
        $location = sprintf(__DIR__.'/../../assets/OpenWeather/%s/%s.%s', $type, $this->image, $type);
        $blob = sprintf('data:image/%s;base64,%s',
            $type,
            base64_encode(file_get_contents($location))
        );

        if ($getHtmlTag) {
            return sprintf(
                '<img src="%s" alt="%s" title="%s" class="open-weather-image">',
                $blob,
                $this->description,
                $this->description
            );
        }

        return $blob;
    }
1224978
public function getLink($type = 'edit')
	{
		$links = $this->xml->link;

		foreach ($links as $link)
		{
			if ($link->attributes()->rel == $type)
			{
				return (string) $link->attributes()->href;
			}
		}

		return false;
	}
249258
public function getThumbAttribute()
    {
        if (!$this->isImage)
            return null;

        $thumb_style = ImageStyle::where('name', 'Chronos Thumbnail')->first()->id;
        $thumb = $this->image_styles()->where('image_style_id', $thumb_style)->first();

        if ($thumb)
            return $thumb->file;
        else
            return $this->file;
    }
1321293
public function srcset($attributes = [])
    {
        if ($images = $this->transformed) {
            $widths = [];
            $result = '';

            foreach ($images as $image) {
                $keys  = array_keys($image);
                $width = $image['width'] ?? $image['w'] ?? null;
                if ($width && !isset($widths[ $width ])) {
                    $withs[ $width ] = true;
                    $result          .= $image['url'] . ' ' . $width . 'w, ';
                }
            }

            $srcset   = substr($result, 0, strlen($result) - 2);
            $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="' . $images[0]['url'] . '" ' . ($lazyLoad ? $this->lazyLoadPrefix : '') . 'srcset="' . $srcset . '" ' . $tagAttributes . ' />');
        }

        return null;
    }
1255255
public function get_icon($alt, array $attributes = null) {
        global $COMPLETION_CRITERIA_TYPES;

        $criteriatype = $COMPLETION_CRITERIA_TYPES[$this->criteriatype];
        return new pix_icon('i/'.$criteriatype, $alt, 'moodle', $attributes);
    }
1307253
private function createElement($type, $children = array(), array $attributes = array(), $text = null)
    {
        $element = new NodeElement();
        $element->openTag($type);

        if (!empty($attributes)) {
            $element->addAttributes($attributes);
        }

        if (!empty($children)) {
            if ($children instanceof NodeElement) {
                $children = array($children);
            }

            $element->appendChildren($children);
        }

        if ($text !== null) {
            $element->setText($text);
        }

        $element->closeTag();

        return $element;
    }
96520
public function getImages($type = null)
    {
        if ($type) {
            if (! isset($this->imagesOfType[$type])) {
                if (count($this->images)) {
                    $this->imagesOfType[$type] = $this->images->where('image_type', $type);
                } else {
                    $this->imagesOfType[$type] = collect([]);
                }
            }

            return $this->imagesOfType[$type];
        }

        return $this->images;
    }
349187
public function img($conversion = '', array $extraAttributes = []): string
    {
        if (! (new Image())->canHandleMime($this->mime_type)) {
            return '';
        }

        if (is_array($conversion)) {
            $attributes = $conversion;

            $conversion = $attributes['conversion'] ?? '';

            unset($attributes['conversion']);

            $extraAttributes = array_merge($attributes, $extraAttributes);
        }

        $attributeString = collect($extraAttributes)
            ->map(function ($value, $name) {
                return $name.'="'.$value.'"';
            })->implode(' ');

        if (strlen($attributeString)) {
            $attributeString = ' '.$attributeString;
        }

        $media = $this;

        $viewName = 'image';

        $width = '';

        if ($this->hasResponsiveImages($conversion)) {
            $viewName = config('medialibrary.responsive_images.use_tiny_placeholders')
                ? 'responsiveImageWithPlaceholder'
                : 'responsiveImage';

            $width = $this->responsiveImages($conversion)->files->first()->width();
        }

        return view("medialibrary::{$viewName}", compact(
            'media',
            'conversion',
            'attributeString',
            'width'
        ));
    }
895300
private function processWidget($type,$attributes,$offset)
	{
		$attrs=$this->processAttributes($attributes);
		if(empty($attrs))
			return $this->generatePhpCode("\$this->widget('$type');",$offset);
		else
			return $this->generatePhpCode("\$this->widget('$type', array($attrs));",$offset);
	}
47483
public static function getOsimages($type = null)
    {
        return Yii::$app->cache->getOrSet([__METHOD__, $type], function () use ($type) {
            return Osimage::find()->andFilterWhere(['type' => $type])->all();
        }, 3600);
    }
85196
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('input', null,
            array_merge(
                [
                    'type'    => 'radio',
                    'name'    => $this->name !== '' ? $this->name : false,
                    'value'   => $this->value,
                    'checked' => $this->isSelected,
                ],
                $attributes
            )
        );
    }
108164
public function getFrames($id, $type)
    {
        $dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
        if (!$dom) {
            return [];
        }
        $images = (new \DOMXPath($dom))->query('//table//table//table//img');
        $frames = [];
        foreach ($images as $image) {
            $src = $this->getAttrAsArray($image)['src'];
            $entity = new Image();
            if ($type == self::ITEM_TYPE_ANIMATION) {
                $src = str_replace('optimize_b', 'optimize_d', $src);
                if (strpos($src, 'http://') === false) {
                    $src = $this->browser->getHost().'/'.$type.'/'.$src;
                }
                if (preg_match('/\-(?<image>\d+)\-optimize_d(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                    $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                    if ($this->uploadImage($src, $entity)) {
                        $frames[] = $entity;
                    }
                }
            } elseif (preg_match('/_(?<round>\d+)\/.+\/(?<id>\d+)-(?<image>\d+)-.+(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                $src = $this->browser->getHost().'/'.$type.'/img/'.$mat['round'].'/'.$mat['id'].'/'.$mat['image'].$mat['ext'];
                $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                if ($this->uploadImage($src, $entity)) {
                    $frames[] = $entity;
                }
            }
        }

        return $frames;
    }
709049
public function makeAssets($type = null)
    {
        if ($type != null) {
            $type = strtolower($type);
        }
        $result = null;
        $reserved = ['build'];

        $this->removeDuplicates();

        if ($type == null || $type == 'css') {
            foreach ($this->assets['css'] as $asset) {

                /*
                 * Prevent duplicates
                 */
                $attributes = Html::attributes(array_merge(
                    [
                        'rel'  => 'stylesheet',
                        'href' => $this->getAssetEntryBuildPath($asset)
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<link' . $attributes . '>' . PHP_EOL;
            }
        }

        if ($type == null || $type == 'rss') {
            foreach ($this->assets['rss'] as $asset) {
                $attributes = Html::attributes(array_merge(
                    [
                        'rel'   => 'alternate',
                        'href'  => $this->getAssetEntryBuildPath($asset),
                        'title' => 'RSS',
                        'type'  => 'application/rss+xml'
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<link' . $attributes . '>' . PHP_EOL;
            }
        }

        if ($type == null || $type == 'js') {
            foreach ($this->assets['js'] as $asset) {
                $attributes = Html::attributes(array_merge(
                    [
                        'src' => $this->getAssetEntryBuildPath($asset)
                    ],
                    array_except($asset['attributes'], $reserved)
                ));

                $result .= '<script' . $attributes . '></script>' . PHP_EOL;
            }
        }

        return $result;
    }
250021
protected function _fontIcon($type, $options, $attributes) {
		$iconClass = $type;

		$options += $this->_config;
		if ($options['autoPrefix'] && $options['iconNamespace']) {
			$iconClass = $options['iconNamespace'] . '-' . $iconClass;
		}
		if ($options['iconNamespace']) {
			$iconClass = $options['iconNamespace'] . ' ' . $iconClass;
		}

		if (isset($this->_config['fontIcons'][$type])) {
			$iconClass = $this->_config['fontIcons'][$type];
		}

		$defaults = [
			'class' => 'icon icon-' . $type . ' ' . $iconClass,
			'escape' => true,
		];
		$options += $defaults;

		if (!isset($attributes['title'])) {
			$attributes['title'] = ucfirst($type);
			if (!isset($options['translate']) || $options['translate'] !== false) {
				$attributes['title'] = __($attributes['title']);
			}
		}

		$attributes += [
			'data-placement' => 'bottom',
			'data-toggle' => 'tooltip'
		];
		$formatOptions = $attributes + [
			'escape' => $options['escape'],
		];

		$options['attributes'] = $this->template->formatAttributes($formatOptions);
		return $this->template->format('icon', $options);
	}