Returns an ElggFile containing the entity icon

@param \ElggEntity $entity Entity
@param string      $size   Size
@return \ElggFile
320650
public function getIconFile(\ElggEntity $entity, $size = '') {

		$dir = $this->getIconDirectory($entity, $size);
		$filename = $this->getIconFilename($entity, $size);

		if ($entity instanceof \ElggUser) {
			$owner_guid = $entity->guid;
		} else if ($entity->owner_guid) {
			$owner_guid = $entity->owner_guid;
		} else {
			$owner_guid = elgg_get_site_entity();
		}
		
		$file = new \ElggFile();
		$file->owner_guid = $owner_guid;
		$file->setFilename("{$dir}/{$filename}");
		$file->mimetype = $file->detectMimeType();

		return $file;
	}
126947
public function getMapSizeMarker($size)
    {
        $b = '';

        if ($size < Constants::SIZE_TINY) {
            $b .= chr(Constants::MAP_TINY + $size);

            return $b;
        }

        if ($size < Constants::SIZE_8) {
            $b .= chr(Constants::MAP_8);
            $b .= $this->packUnsignedShortShort($size);

            return $b;
        }

        if ($size < Constants::SIZE_16) {
            $b .= chr(Constants::MAP_16);
            $b .= $this->packUnsignedShort($size);

            return $b;
        }

        if ($size < Constants::SIZE_32) {
            $b .= chr(Constants::MAP_32);
            $b .= $this->packUnsignedLong($size);

            return $b;
        }

        throw new SerializationException(sprintf('Unable to pack Array with size %d. Out of bound !', $size));
    }
340306
public function getCoverFile($size)
    {
        $coverFilename = $this->coverFilename;

        //get the extension
        $extension = explode('.', $coverFilename);
        $extension = array_pop($extension);

        //remove file extension
        $name = preg_replace('#\.[^.]*$#', '', $coverFilename);
        $coverFilename = $name.'_'.$size.'.'.$extension;

        return $coverFilename;
    }
1137905
public function generateBody(Entity $entity)
    {
        $lines      = [];
        $addLine    = false;
        $descriptor = $entity->getDescriptor();
        $fields     = $descriptor->getFieldList() ?: [];
        $defaults   = $this->generateDefaultValues($entity);

        foreach ($fields as $field) {
            if ($field->getLabel() !== Label::LABEL_REQUIRED()) {
                continue;
            }

            if ($field->hasDefaultValue()) {
                continue;
            }

            $item  = $this->generateRequiredFieldException($entity, $field);
            $lines = array_merge($lines, $item, [null]);
        }

        $lines[] = '$message = new self();';
        $lines[] = '$values  = array_merge([';
        $lines   = array_merge($lines, $this->addIndentation($defaults, 1));
        $lines[] = '], $values);';
        $lines[] = null;

        foreach ($fields as $field) {
            if ($field->getLabel() === Label::LABEL_REPEATED()) {
                continue;
            }

            $item  = $this->generateSetValue($entity, $field);
            $lines = array_merge($lines, $item);

            $addLine = true;
        }

        if ($addLine) {
            $lines[] = null;
        }

        foreach ($fields as $field) {
            if ($field->getLabel() !== Label::LABEL_REPEATED()) {
                continue;
            }

            $item  = $this->generateAddValue($entity, $field);
            $lines = array_merge($lines, $item, [null]);
        }

        $lines[] = 'return $message;';

        return $lines;
    }
259174
public function pixelate( $size, $effect = FALSE )
	{
		return imagefilter( $this->image->getResource(), IMG_FILTER_PIXELATE, $size, $effect );
	}
715031
public function iconUrl($image, $size = 16)
    {
        if (!$image) {
            return '';
        }

        $parts = explode(';', $image);
        $fileId = $parts[0];

        $src = $this->router->generate('frontendmedia_icon', ['fileId' => $fileId, 'size' => $size], UrlGeneratorInterface::ABSOLUTE_URL);

        return $src;
    }
290561
public function defaultRender($entity)
    {
        $joinEntity = $this->getJoinEntity($entity);

        if (!$joinEntity instanceof UmbrellaFile) {
            return null;
        }

        $attr = array_merge(['title' => $joinEntity->name], $this->imageAttr);

        $url = $joinEntity->getWebPath();
        if (!empty($this->imagineFilter)) {
            $url = $this->cacheManager->getBrowserPath($url, $this->imagineFilter);
        }
        return '<img src="' . $url . '" ' . HtmlUtils::array_to_html_attribute($attr) . '>';
    }
833265
public static function getSizedImagePath($uuid, $size)
    {
        $container = \System::getContainer();
        $rootDir = $container->getParameter('kernel.project_dir');

        if (!($path = Files::getPathFromUuid($uuid))) {
            return false;
        }

        $size = unserialize($size);

        if (is_array($size))
        {
            if (count($size) < 3)
            {
                return false;
            }
            else
            {
                $size = $size[2];
            }
        }

        return $container->get('contao.image.image_factory')->create(
            $rootDir . '/' . $path, $size
        )->getUrl($rootDir);
    }
89343
public function thumbnail($size = null)
    {
        $size = ($size) ? $size : $this->config->get('images.size');

        if ($id = $this->thumbnailId) {
            return new Image($id, $size);
        }
    }
1065793
public function src($email, $size = 100, $rating = null)
    {
        $this->gravatar->setAvatarSize($size);

        if (! is_null($rating)) {
            $this->gravatar->setMaxRating($rating);
        }

        return htmlentities($this->gravatar->buildGravatarURL($email));
    }
1193760
private function getImagePath(FileStorage $entity, string $version) : string
    {
        $hash = (string)Configure::read(sprintf('FileStorage.imageHashes.file_storage.%s', $version));
        if (empty($hash)) {
            return $entity->get('path');
        }

        $event = new Event('ImageVersion.getVersions', $this, [
            'hash' => $hash,
            'image' => $entity,
            'version' => $version,
            'options' => [],
            'pathType' => 'fullPath'
        ]);

        EventManager::instance()->dispatch($event);

        if (! $event->getResult()) {
            return $entity->get('path');
        }

        return file_exists(WWW_ROOT . trim($event->getResult(), DS)) ?
            $event->getResult() :
            $entity->get('path');
    }
927152
public function thumbnailUrl($size = null, $icon = false)
    {
        $data = wp_get_attachment_image_src(get_post_thumbnail_id($this->id()), $size, $icon);

        return (empty($data)) ? null : $data[0];
    }
1361094
public static function icon($icon, $size = 0, $tag = 'i')
    {
        $icon = preg_replace('/(")(.*?)(")/', '$2', $icon);

        $icon_array = explode(',', $icon, 2);
        $icon = array_get($icon_array, 0);
        if (array_has($icon_array, 1)) {
            $attributes = explode(',', array_get($icon_array, 1, ''));
        }

        if (substr($icon, 1, 1) == ' ') {
            $type = substr($icon, 0, 1);
            $icon = substr($icon, 2);
        } else {
            $type = config('html.icon.default.type', 'l');
        }
        $icon = ($icon[0] === '-') ? substr($icon, 1) : 'fa-'.$icon;
        $size = ($size > 0) ? ' fa-'.$size : '';
        $fa = self::$tag()->addClass('fa'.$type.' fa-fw '.$icon.$size)->aria('hidden', 'true');

        if (isset($attributes) && is_array($attributes)) {
            foreach ($attributes as $attr) {
                list($attr_name, $attr_value) = explode('=', $attr);
                switch ($attr_name) {
                    case 'transform':
                        $fa->data('fa-'.$attr_name, $attr_value);
                        break;
                    default:
                        $fa->attr($attr_name, $attr_value);
                        break;
                }
            }
        }

        return $fa;
    }
400413
public function generateImageUrl($file, $size=null)
	{
		$url = $this->config->get('prefix').'/'.$file;

		if (!is_null($size)) {
			$url .= '?size='.$size;
		}

		return URL::to($url);
	}
995006
public function getThumbnail($size) {
		switch ($size) {
			case 'thumb':
				$thumb = $this->thumbnail;
				break;
			case 'small':
				$thumb = $this->smallthumb;
				break;
			case 'large':
				$thumb = $this->largethumb;
				break;
			default:
				return '';
				break;
		}

		if (!$thumb) {
			return '';
		}

		$file = new ElggFile();
		$file->owner_guid = $this->getOwnerGUID();
		$file->setFilename($thumb);
		return $file->grabFile();
	}
1207633
public function getListSizeMarker($size)
    {
        $b = '';

        if ($size < Constants::SIZE_TINY) {
            $b .= chr(Constants::LIST_TINY + $size);

            return $b;
        }

        if ($size < Constants::SIZE_8) {
            $b .= chr(Constants::LIST_8);
            $b .= $this->packUnsignedShortShort($size);

            return $b;
        }

        if ($b < Constants::SIZE_16) {
            $b .= chr(Constants::LIST_16);
            $b .= $this->packUnsignedShort($size);

            return $b;
        }

        if ($b < Constants::SIZE_32) {
            $b .= chr(Constants::LIST_32);
            $b .= $this->packUnsignedLong($size);

            return $b;
        }

        throw new SerializationException(sprintf('Unable to create marker for List size %d', $size));
    }
994549
protected function createImageSize(ImageReferencedElement $entity, EntityManager $em)
	{
		$imageId = $entity->getImageId();

		$fileStorage = $this->container['cms.file_storage'];
		/* @var $fileStorage \Supra\Package\Cms\FileStorage\FileStorage */

		$image = $fileStorage->findImage($imageId);

		if ($image === null) {
			$this->container->getLogger()->warn(
					"Image [{$imageId}] was not found inside the file storage." .
					" Maybe another file storage must be configured for the image size creator listener?"
			);

			return false;
		}

		$width = $entity->getWidth();
		$height = $entity->getHeight();

		// No dimensions
		if ($width > 0 && $height > 0 || $entity->isCropped()) {

			if ($entity->isCropped()) {
				$sizeName = $fileStorage->createImageVariant($image, $width, $height, $entity->getCropLeft(), $entity->getCropTop(), $entity->getCropWidth(), $entity->getCropHeight());
			} else {
				$sizeName = $fileStorage->createResizedImage($image, $width, $height);
			}
			$entity->setSizeName($sizeName);

			// Maybe could update to real width/height inside image metadata?
//		$size = $image->getImageSize($sizeName);
//		$entity->setWidth($size->getWidth());
//		$entity->setHeight($size->getHeight());
			// Recalculate the changeset because of changed size name field
			$class = $em->getClassMetadata(ImageReferencedElement::CN());
			$unitOfWork = $em->getUnitOfWork();
			$unitOfWork->recomputeSingleEntityChangeSet($class, $entity);
		}
	}