Determines icon filename

@param \ElggEntity $entity Entity
@param string      $size   Size
@return string
434244
public function getIconFilename(\ElggEntity $entity, $size = '') {

		$mimetype = $entity->icon_mimetype ? : $entity->mimetype;
		switch ($mimetype) {
			default :
				$ext = 'jpg';
				break;
			case 'image/png' :
				$ext = 'png';
				break;
			case 'image/gif' :
				$ext = 'gif';
				break;
		}

		$sizes = $this->getSizes($entity);
		if (isset($sizes[$size]['metadata_name'])) {
			$md_name = $sizes[$size]['metadata_name'];
			$filename = $entity->$md_name;
		}
		if (!$filename) {
			$filename = "{$entity->guid}{$size}.{$ext}";
		}
		return elgg_trigger_plugin_hook('entity:icon:directory', $entity->getType(), array(
			'entity' => $entity,
			'size' => $size,
				), $filename);
	}
223093
public function iconPath($image, $size = 16)
    {
        if (!$image) {
            return '';
        }

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

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

        return $src;
    }
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];
    }
401428
public function getEntityClassShort($entity)
    {
        $cacheKey = 'short';
        $entity   = $this->getEntityClassFull($entity);
        $short    = $this->getFromCache($entity, $cacheKey);

        if (false !== $short) {
            return $short;
        }

        foreach ($this->entityManager->getConfiguration()->getEntityNamespaces() as $short => $full) {
            if (false === strpos($entity, $full)) {
                continue;
            }

            $short .= ':'.ltrim(str_replace($full, '', $entity), '\\');
            $this->cache[$full][$cacheKey] = $short;

            return $short;
        }

        return $entity;
    }
1366604
public function getIconDirectory(\ElggEntity $entity, $size = null, $directory = null) {

		$sizes = $this->getSizes($entity);
		if (isset($sizes[$size]['metadata_name'])) {
			$md_name = $sizes[$size]['metadata_name'];
			if ($entity->$md_name) {
				$directory = '';
			}
		}

		if ($directory === null) {
			$directory = $directory ? : $entity->icon_directory;
			if ($entity instanceof \ElggUser) {
				$directory = 'profile';
			} else if ($entity instanceof \ElggGroup) {
				$directory = 'groups';
			} else {
				$directory = $this->config->getDefaultIconDirectory();
			}
		}

		$directory = elgg_trigger_plugin_hook('entity:icon:directory', $entity->getType(), array(
			'entity' => $entity,
			'size' => $size,
				), $directory);

		return trim($directory, '/');
	}
578818
public static function get_image_size($size)
    {
        $sizes = static::get_image_sizes();

        if (\is_string($size) && isset($sizes[ $size ])) {
            return $sizes[ $size ];
        }

        return false;
    }
947322
public function getFileUrl($entity, $field, $fileName = null)
    {
        if (func_num_args() < 3) {
            if ($entity) {
                $fileName = PropertyHelper::getValue($entity, $field);
            }
        }

        if ($fileName instanceof File) {
            $fileName = $fileName->getBasename();
        }

        if ($fileName) {
            return ltrim($this->httpRoot . '/' . $this->getRelativePath($entity, $field) . '/' . $fileName, '/');
        }

        return null;
    }
1276335
public function getImageSrc($type, $size)
	{
		if (empty($this->$type))
		{
			return null;
		}
		return $this->getImageConfig($type, $size, 'dir') . $this->$type;
	}
1017838
public static function get_image_size( $size ) {
		// Check for a directly passed image configuration array.
		if ( is_array( $size ) ) {
			return $size;
		}

		$sizes = self::get_image_sizes();

		// Return found image size.
		if ( isset( $sizes[ $size ] ) ) {
			return $sizes[ $size ];
		}

		self::notice( "Image size \"{$size}\" does not exist in your image configuration." );

		return false;
	}
221797
public function getAvatarUrl($size = 200) {
    $protocol = \Yii::$app->request->isSecureConnection ? 'https' : 'http';

    return $protocol . '://gravatar.com/avatar/' . $this->gravatar_id . '?s=' . $size;
  }
550574
protected function _icon($kind)
    {
        switch ($kind) {
            case 'database':
                if (null === $this->_options['image_path'])
                    return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC';

                return $this->_options['image_path'] . '/database.png';
                break;
            case 'exception':
                if (null === $this->_options['image_path'])
                    return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJPSURBVDjLpZPLS5RhFMYfv9QJlelTQZwRb2OKlKuINuHGLlBEBEOLxAu46oL0F0QQFdWizUCrWnjBaDHgThCMoiKkhUONTqmjmDp2GZ0UnWbmfc/ztrC+GbM2dXbv4ZzfeQ7vefKMMfifyP89IbevNNCYdkN2kawkCZKfSPZTOGTf6Y/m1uflKlC3LvsNTWArr9BT2LAf+W73dn5jHclIBFZyfYWU3or7T4K7AJmbl/yG7EtX1BQXNTVCYgtgbAEAYHlqYHlrsTEVQWr63RZFuqsfDAcdQPrGRR/JF5nKGm9xUxMyr0YBAEXXHgIANq/3ADQobD2J9fAkNiMTMSFb9z8ambMAQER3JC1XttkYGGZXoyZEGyTHRuBuPgBTUu7VSnUAgAUAWutOV2MjZGkehgYUA6O5A0AlkAyRnotiX3MLlFKduYCqAtuGXpyH0XQmOj+TIURt51OzURTYZdBKV2UBSsOIcRp/TVTT4ewK6idECAihtUKOArWcjq/B8tQ6UkUR31+OYXP4sTOdisivrkMyHodWejlXwcC38Fvs8dY5xaIId89VlJy7ACpCNCFCuOp8+BJ6A631gANQSg1mVmOxxGQYRW2nHMha4B5WA3chsv22T5/B13AIicWZmNZ6cMchTXUe81Okzz54pLi0uQWp+TmkZqMwxsBV74Or3od4OISPr0e3SHa3PX0f3HXKofNH/UIG9pZ5PeUth+CyS2EMkEqs4fPEOBJLsyske48/+xD8oxcAYPzs4QaS7RR2kbLTTOTQieczfzfTv8QPldGvTGoF6/8AAAAASUVORK5CYII=';

                return $this->_options['image_path'] . '/exception.png';
                break;
            case 'error':
                if (null === $this->_options['image_path'])
                    return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIsSURBVDjLpVNLSJQBEP7+h6uu62vLVAJDW1KQTMrINQ1vPQzq1GOpa9EppGOHLh0kCEKL7JBEhVCHihAsESyJiE4FWShGRmauu7KYiv6Pma+DGoFrBQ7MzGFmPr5vmDFIYj1mr1WYfrHPovA9VVOqbC7e/1rS9ZlrAVDYHig5WB0oPtBI0TNrUiC5yhP9jeF4X8NPcWfopoY48XT39PjjXeF0vWkZqOjd7LJYrmGasHPCCJbHwhS9/F8M4s8baid764Xi0Ilfp5voorpJfn2wwx/r3l77TwZUvR+qajXVn8PnvocYfXYH6k2ioOaCpaIdf11ivDcayyiMVudsOYqFb60gARJYHG9DbqQFmSVNjaO3K2NpAeK90ZCqtgcrjkP9aUCXp0moetDFEeRXnYCKXhm+uTW0CkBFu4JlxzZkFlbASz4CQGQVBFeEwZm8geyiMuRVntzsL3oXV+YMkvjRsydC1U+lhwZsWXgHb+oWVAEzIwvzyVlk5igsi7DymmHlHsFQR50rjl+981Jy1Fw6Gu0ObTtnU+cgs28AKgDiy+Awpj5OACBAhZ/qh2HOo6i+NeA73jUAML4/qWux8mt6NjW1w599CS9xb0mSEqQBEDAtwqALUmBaG5FV3oYPnTHMjAwetlWksyByaukxQg2wQ9FlccaK/OXA3/uAEUDp3rNIDQ1ctSk6kHh1/jRFoaL4M4snEMeD73gQx4M4PsT1IZ5AfYH68tZY7zv/ApRMY9mnuVMvAAAAAElFTkSuQmCC';

                return $this->_options['image_path'] . '/error.png';
                break;
            case 'close':
                return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABHElEQVQoFZ2SMUsDQRCFN6eRIIIS0MZW0gUs72orayvh/C3HNfkXV/kftEhz3V0pigghrc0VQdsYiO/b3MAaYgh58HZ2387czt6+jvuLvpaX4oV41m59KTbipzhrNdexieKVOBBPAy2cfmsxEaeIBwwCRdfiMYt/0JNOJ3NxFmmgPU7qii7P8yExRKCRQy41jsR7qITRUqiq6sk05mjsmaY45I43Ii14KPEhjuPbuq6fEWyeJMnjKsOPDYV34lEgOitG4wNrRchz7rgXDlXFO21tVR24tVOp2e/n8I4L8VzslWXZRFE0SdN0rLVHURSvaFmWvbUSRvgw55gB/Fu2CZvCj8QXcWrOwYM44kTEIZvASe+it5ydaIk7m/wXTbV0eSnRtrUAAAAASUVORK5CYII=';
                break;
            default:
                if (null === $this->_options['image_path'])
                    return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHhSURBVDjLpZI9SJVxFMZ/r2YFflw/kcQsiJt5b1ije0tDtbQ3GtFQYwVNFbQ1ujRFa1MUJKQ4VhYqd7K4gopK3UIly+57nnMaXjHjqotnOfDnnOd/nt85SURwkDi02+ODqbsldxUlD0mvHw09ubSXQF1t8512nGJ/Uz/5lnxi0tB+E9QI3D//+EfVqhtppGxUNzCzmf0Ekojg4fS9cBeSoyzHQNuZxNyYXp5ZM5Mk1ZkZT688b6thIBenG/N4OB5B4InciYBCVyGnEBHO+/LH3SFKQuF4OEs/51ndXMXC8Ajqknrcg1O5PGa2h4CJUqVES0OO7sYevv2qoFBmJ/4gF4boaOrg6rPLYWaYiVfDo0my8w5uj12PQleB0vcp5I6HsHAUoqUhR29zH+5B4IxNTvDmxljy3x2YCYUwZVlbzXJh9UKeQY6t2m0Lt94Oh5loPdqK3EkjzZi4MM/Y9Db3MTv/mYWVxaqkw9IOATNR7B5ABHPrZQrtg9sb8XDKa1+QOwsri4zeHD9SAzE1wxBTXz9xtvMc5ZU5lirLSKIz18nJnhOZjb22YKkhd4odg5icpcoyL669TAAujlyIvmPHSWXY1ti1AmZ8mJ3ElP1ips1/YM3H300g+W+51nc95YPEX8fEbdA2ReVYAAAAAElFTkSuQmCC';

                return $this->_options['image_path'] . '/unknown.png';
                break;
        }
    }
830619
public function url($size)
    {

        return $this->img_server . '/' . $this->type . '/' . $this->id .
            '_' . $size . '.' . $this->extension;

    }
1216308
public static function getStats($entity) {

		if (!$entity instanceof ElggEntity) {
			return array();
		}

		$stats = array(
			'comments' => array(
				'count' => $entity->countComments()
			),
			'likes' => array(
				'count' => $entity->countAnnotations('likes'),
				'state' => (elgg_annotation_exists($entity->guid, 'likes')) ? 'after' : 'before',
			)
		);

		return elgg_trigger_plugin_hook('get_stats', 'interactions', array('entity' => $entity), $stats);
	}
994462
static public function getThumbFilename($filename, $mimeType, $size)
    {
        if (substr($mimeType, 0, 5) == 'image')
        {
            $pos = mb_strrpos($filename, '.');
            if ($pos === FALSE)
            {
                return $filename . '_' . $size['width'] . 'x' . $size['height'];
            }
            else
            {
                return mb_substr($filename, 0, $pos) . '_' . $size['width'] . 'x' . $size['height'] . mb_substr($filename, $pos);
            }
        }
        else if ($mimeType == 'application/pdf')
        {
            return $GLOBALS['kernel']->getContainer()->get('templating.helper.assets')->getUrl('bundles/fulguriolightcms/img/thumb_pdf.png');
        }
        else
        {
            return 'http://www.placehold.it/' . $size['width'] . 'x' . $size['height'] . '/EFEFEF/AAAAAA';
        }
    }
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) . '>';
    }
41292
public function getEntity($filename)
  {
    $changes = $this->getChanges();

    $filename = Entity::fixPath($filename);
    $parts = explode("/", $filename);
    $basename = array_pop($parts);

    $filepath = "";
    $partiallyFilepath = "";
    $changesStage = false;
    $directory = $this->getRoot();

    foreach ($parts as $name) {
      $filepath .= ($filepath ? "/" : "") . $name;

      if ($partiallyFilepath) {
        $partiallyFilepath = $partiallyFilepath . "/" . $name;
      } else {
        $partiallyFilepath = $name;
      }

      $changesExists = $changes->exists($filepath);
      if ($changesExists || $changesStage) {
        $changesStage = true;
        if ($changesExists) {
          $directory = $changes->get($filepath);
          $partiallyFilepath = "";
          if (!$directory->file_exists() || !$directory->is_dir()) {
            return null;
          }
        } else {
          return null;
        }
      } else {
        $path = $directory->path() . "/" . $filepath;
        if (!file_exists($path) || !is_dir($path)) {
          return null;
        }
      }
    }

    if ($changes->exists($filename)) {
      $entity = $changes->get($filename);
    } else {
      $entity = Entity::newInstance(
        $directory->path() .
        ($partiallyFilepath ? "/" . $partiallyFilepath : "") .
        "/" . $basename
      );
    }
    return $entity;
  }
690505
public function generate($size)
    {
        $result = '';
        while (Util::safeStrlen($result) < $size) {
            $result = uniqid($result, true);
        }

        return Util::safeSubstr($result, 0, $size);
    }