Loads an image from the file with the given fileName.
Returns true if the image was successfully loaded; otherwise returns false.
The loader attempts to read the image using the specified format, e.g., PNG or JPG.

@param string $fileName
@return boolean
769397
public function load( $fileName )
    {
        $file = new MFileInfo( $fileName );
        $resource = false;
        $this->type = $file->getSuffix();

        if( $this->type == "png" )
        {
            $resource = imageCreateFromPng( $fileName );
            if( $resource )
            {
                imageAlphaBlending( $resource, true );
                imageSaveAlpha( $resource, true );
            }
        }
        else
        {
            if( $this->type == "gif" )
            {
                $resource = imagecreatefromgif( $fileName );
            }
            else
            {
                if( $this->type == "jpg" || $this->type == "jpeg" )
                {
                    $resource = imagecreatefromjpeg( $fileName );
                }
                else
                {
                    return false;
                }
            }
        }

        if( $resource === false )
        {
            return false;
        }

        $this->resource = $resource;
        $this->fileName = $fileName;
        $this->width = imagesx( $this->resource );
        $this->height = imagesy( $this->resource );

        return true;
    }
1096781
function read($filename){
		$filename = md5($filename);
		$filepath = $this->getConfig('cache_path').$filename.'.tmp';
		
		if(!file_exists($filepath)){
			return FALSE;
		}
		
		if ( ! $fp = @fopen($filepath, 'r')){
			return FALSE;
		}
		flock($fp, LOCK_SH);

		$cache = '';
		if (filesize($filepath) > 0)
		{
			$cache = fread($fp, filesize($filepath));
		}

		flock($fp, LOCK_UN);
		fclose($fp);

		// Strip out the embedded timestamp
		if ( ! preg_match("/(\d+T_SKY-->)/", $cache, $match))
		{
			return FALSE;
		}
		// Has the file expired? If so we'll delete it.
		if (time() >= trim(str_replace('TS--->', '', $match['1'])))
		{
			if (is_writable($filepath))
			{
				@unlink($filepath);
				return FALSE;
			}
		}

		// Display the cache
		return str_replace($match['0'], '', $cache);
	}
1266586
public function imageCreateJpegfromExif($filename)
    {
        $img = imagecreatefromjpeg($filename);

        if (!function_exists('exif_read_data') || !isset($this->source_info['APP1'])  || strpos($this->source_info['APP1'], 'Exif') !== 0) {
            return $img;
        }

        try {
            $exif = @exif_read_data($filename);
        } catch (Exception $e) {
            $exif = null;
        }

        if (!$exif || !isset($exif['Orientation'])) {
            return $img;
        }

        $orientation = $exif['Orientation'];

        if ($orientation === 6 || $orientation === 5) {
            $img = imagerotate($img, 270, null);
        } elseif ($orientation === 3 || $orientation === 4) {
            $img = imagerotate($img, 180, null);
        } elseif ($orientation === 8 || $orientation === 7) {
            $img = imagerotate($img, 90, null);
        }

        if ($orientation === 5 || $orientation === 4 || $orientation === 7) {
            if(function_exists('imageflip')) {
                imageflip($img, IMG_FLIP_HORIZONTAL);
            } else {
                $this->imageFlip($img, IMG_FLIP_HORIZONTAL);
            }
        }

        return $img;
    }
737997
public static function fileExists($fileName)
    {
        $fp = @fopen($fileName, 'r', true);
        if (is_resource($fp)) {
            fclose($fp);
            return true;
        }
        return false;
    }
1135566
protected function checkFileType($filename) {

        if ( $this->config['allow_ext'] == '*' ) {
            return true;
        }
		$_ext = strtolower(self::getFileExt($filename));
        $_allow_ext = explode("|", $this->config['allow_ext']);
		if ( !in_array($_ext, $_allow_ext) ) {
			$this->errNum = 5;
            return false;
		}
        return true;
	}
1346109
public function getFile($fileName)
    {
        $result = false;

        if (isset($_FILES[$fileName])) {
            $result = $_FILES[$fileName];
        }

        return $result;
    }
691632
protected function fetchObject( $filename )
    {
        $data = $this->backend->fetch( $filename );
        return ( is_object( $data ) ) ? $data : false;
    }
699929
public function get($filename)
    {
        if (!$stream = $this->readStream($filename)) {
            return false;
        }

        $contents = stream_get_contents($stream);

        fclose($stream);

        return $contents;
    }
497752
public static function open($fileName)
    {
        self::checkRequirements();

        if (!file_exists($fileName) || !is_readable($fileName))
            throw new Exception('Could not open file: '.$fileName);

        $type = self::detectArchiveType($fileName);
        if (!self::canOpenType($type)) {
            return null;
        }

        return new self($fileName, $type);
    }
292133
public function loadFile( $fileName )
	{
		if( !file_exists( $fileName ) )
			throw new Exception( 'XML File "'.$fileName.'" is not existing.' );
		$this->document	= new DOMDocument();
		$this->document->load( $fileName );
		$this->xPath	= new DOMXpath( $this->document );
		return true;
	}
723210
public function loadYamlFile($filename)
    {
        if (!file_exists($filename)) {
            $this->output->writeln("<error>The file $filename does not exist.</error>");

            return false;
        }

        try {
            $contents = Yaml::parse(file_get_contents($filename));
        } catch (\Exception $e) {
            $this->output->writeln("<error>There was an error parsing $filename. The contents are not valid YAML.</error>");
            $this->output->writeln($e->getMessage());

            return false;
        }

        return $contents;
    }
1056751
public static function load( $fileName )
	{
		$file	= new FS_File_Reader( $fileName );
		if( !$file->exists() )
			throw new Exception( "File '".$fileName."' is not existing." );
		$xml	= $file->readString();
		$parser	= new XML_OPML_Parser();
		return $parser->parse( $xml );
	}
306011
private function readFile($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception(sprintf('File not found: %s', $filename));
        }
        if (!is_readable($filename) || ($content = file_get_contents($filename)) === false) {
            throw new \Exception(sprintf('Failed to read file: %s', $filename));
        }

        return $content;
    }
62804
public function tryLoad($filename)
    {
        if (is_readable($filename) && is_file($filename)) {
            $this->loadTemplateFromString(file_get_contents($filename));
            $this->source = 'loaded from file: '.$filename;

            return $this;
        }

        return false;
    }
1219046
public function open($filename)
    {
        if (true === $this->openned) {
            $this->close();
        }
        if (!file_exists(self::TMP_DIR)) {
            mkdir(self::TMP_DIR);
        }
        $this->filename = $filename;
        $this->pclzip = new \PclZip($this->filename);
        $this->openned = true;
        return true;
    }
1208069
static public function open($filename) {
		if (!file_exists($filename))
			throw new Exception('Invalid (filename) parameter! File does not exist!');

		$image_info = getimagesize($filename);
		if ($image_info === false)
			throw new Exception('Invalid (filename) parameter! File is corrupted!');

		switch ($image_info[2]) {
			case IMAGETYPE_JPEG:
			case IMAGETYPE_JPEG2000:
				$image = imagecreatefromjpeg($filename);
				break;
			case IMAGETYPE_PNG:
				$image = imagecreatefrompng($filename);
				break;
			case IMAGETYPE_GIF:
				$image = imagecreatefromgif($filename);
				break;
			case IMAGETYPE_WBMP:
				$image = imagecreatefromwbmp($filename);
				break;
			case IMAGETYPE_BMP:
				$image = imagecreatefrombmp($filename);
				break;
			case IMAGETYPE_XBM:
				$image = imagecreatefromxbm($filename);
				break;
			case IMAGETYPE_XPM:
				$image = imagecreatefromxpm($filename);
				break;
			case IMAGETYPE_WEBP:
				$image = imagecreatefromwebp($filename);
				break;
			default:
				throw new Exception('Unknown image format!');
				break;
		}
		imagealphablending($image, false);
		imagesavealpha($image, true);

		return new self($image);
	}
1369916
final protected function _loadImage($fname)
	{
		$data = getimagesize($fname);
		if (is_array($data)) {
			list(
				$this->_image_width,
				$this->_image_height,
				$this->_image_type,
				$this->_image_attr
			) = $data;

			$this->_image_mime = array_key_exists('mime', $data)
				? $data['mime']
				: image_type_to_mime_type($this->_image_type);

			switch ($this->_image_type) {
				case IMAGETYPE_JPEG:
					$this->_image_handle = imagecreatefromjpeg($fname);
					break;

				case IMAGETYPE_PNG:
					$this->_image_handle = imagecreatefrompng($fname);
					break;

				case IMAGETYPE_GIF:
					$this->_image_handle = imagecreatefromgif($fname);
					break;
				default:
					trigger_error(sprintf('Unsupported file type for "%s"', $fname));
					break;
			}
		}
	}