Get full image info (dimesions, mime-type etc)

@param string $filename
@return ImageInfo
5483
public function getImageInfo($filename)
	{
		if ($filename instanceof Image) {
			$filename = $this->adapter->getFileStorage()->getImagePath($filename);
		}

		$info = new ImageInfo($filename);

		if ($info->hasError()) {
			throw new ImageProcessorException('File ' . $filename . ' not found or is not readable. ' . $info->getError());
		}

		return $info;
	}
1372610
protected function _getMime($filename, $default = 'application/octet-stream') {
		if (!isset($this->_Mime)) {
			$this->_Mime = new Mime();
		}
		$mime = $this->_Mime->detectMimeType($filename);
		// Some environments falsely return the default too fast, better fallback to extension here
		if (!$mime || $mime === $default) {
			$ext = pathinfo($filename, PATHINFO_EXTENSION);
			$mime = $this->_Mime->getMimeTypeByAlias($ext);
		}
		return $mime;
	}
1118458
public static function getMimeTypeFromFilename($fileName)
    {
        $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
        if (array_key_exists($ext, self::$customMimeTypes)) {
            return self::$customMimeTypes[$ext];
        } else if (array_key_exists($ext, self::$mimeTypes)) {
            return self::$mimeTypes[$ext];
        }
        return 'application/octet-stream';
    }
673306
public function getPngType($filename = null)
    {
        $filename = $filename ? $filename : $this->pathToImage;

        $pngType = ord(file_get_contents($filename, false, null, 25, 1));

        if ($this->verbose) {
            $this->log("Checking png type of: " . $filename);
            $this->log($this->getPngTypeAsString($pngType));
        }

        return $pngType;
    }
696279
public function getFileInformation($DirectoryName)
    {
        $directory_b64 = base64_encode($DirectoryName);
        $result        = $this->callService('GET', self::API_FS_INFO . $directory_b64);

        return $result->getModel(models\FileSystem\FileInfo::class);
    }
132343
public function getFile($filename)
    {
        $filename = $this->outDir.DIRECTORY_SEPARATOR.$filename;
        $this->mkdir(dirname($filename));
        if (is_file($filename) && $this->backup) {
            @rename($filename, sprintf('%s.bak', $filename));
        }

        return $filename;
    }
1201414
public function getResizedImageInfo()
    {
        $fileInfo = null;
        if ($this->newFile === true) {
            $asset = $this->assetRepo->createAsset(
                "Limesharp_Stockists::images/".$this->entityCode."/placeholder/{$this->getDestinationSubdir()}.jpg"
            );
            $img = $asset->getSourceFile();
            $fileInfo = getimagesize($img);
        } else {
            if ($this->mediaDirectory->isFile($this->mediaDirectory->getAbsolutePath($this->newFile))) {
                $fileInfo = getimagesize($this->mediaDirectory->getAbsolutePath($this->newFile));
            }
        }
        return $fileInfo;
    }
1221855
private static function lookupContentType($filename) {
    foreach ($_FILES as $file) {
      if ($file['tmp_name'] == $filename) {
        return $file['type'] ?: static::DEFAULT_CONTENT_TYPE;
      }
    }
    return static::DEFAULT_CONTENT_TYPE;
  }
866003
public function getFile( $fileName )
	{
		if( !$this->numFiles )
			return NULL;
		foreach( $this->files as $key => $information )
			if( $information['name'] == $fileName )
				return $information;
	}
1163416
private function  &getImageSource($filename) {

        $image = NULL;
        $extesion = self::getFileExt($filename);
        switch ( $extesion ) {

            case 'gif':
                $image = imagecreatefromgif($filename);
                break;

            case 'png':
                $image = imagecreatefrompng($filename);
                break;

            case 'jpg':
            case 'jpeg':
                $image = imagecreatefromjpeg($filename);
                break;

        }
        return $image;
    }
703035
public static function getMediaTypeFromFilename(string $filename): string
    {
        $pathinfo = pathinfo(strtolower($filename));
        if (!isset($pathinfo['extension'])) {
            return 'application/octet-stream';
        }
        return self::$extensionToMediaType[$pathinfo['extension']] ?? 'application/octet-stream';
    }
1139869
public function getImageSize($sizeName)
	{
		$size = $this->findImageSize($sizeName);
		if ( ! $size instanceof ImageSize) {
			$size = new ImageSize($sizeName);
			$size->setMaster($this);
		}
		return $size;
	}
709839
static public function getUploadFilePath($filename)
    {
        if ($filename) {
            $filename = static::getUploadFileRelativePath($filename);
            
            if (static::isRootImageFile($filename)) {
                
                return static::getWebRootPath() . $filename;
            }
            
            $filename = static::getUploadPath() . $filename;
        }
        
        return $filename;
    }
771745
public function isSupportedImageFormat($filename)
	{
		$info = new ImageInfo($filename);
		if ($info->hasError()) {
			$this->container->getLogger()->error($info->getError());
			return false;
		}

		if ( ! $this->isMimeTypeImage($info->getMime())) {
			return false;
		}

		return ImageProcessor\ImageProcessor::isSupportedImageType($info->getType());
	}
233291
protected function getImagePath($filename)
    {
        // find file
        foreach (config('imagecache.paths') as $path) {
            // don't allow '..' in filenames
            $image_path = $path.'/'.str_replace('..', '', $filename);
            if (file_exists($image_path) && is_file($image_path)) {
                // file found
                return $image_path;
            }
        }

        // file not found
        abort(404);
    }
542269
function size($filename)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }

        $result = $this->stat($filename);
        if ($result === false) {
            return false;
        }
        return isset($result['size']) ? $result['size'] : -1;
    }
464367
public static function from($filename)
    {
        $extension = strtok(pathinfo($filename, PATHINFO_EXTENSION), '?');

        return self::getMimeTypeFromExtension($extension);
    }