protected function getGdResource($imageFile)
    {
        $imageInfo = getimagesize($imageFile);

        switch($imageInfo['mime'])
        {
            case 'image/jpg':
            case 'image/jpeg':
                return $this->normalizeGdResource(imagecreatefromjpeg($imageFile));

            case 'image/gif':
                return $this->normalizeGdResource(imagecreatefromgif($imageFile));

            case 'image/png':
                return $this->normalizeGdResource(imagecreatefrompng($imageFile));
        }

        throw new Exception('GD resource not supported image extension');
    }
protected function getGdResource($imageFile)
    {
        $imageInfo = getimagesize($imageFile);

        switch($imageInfo['mime'])
        {
            case 'image/jpg':
            case 'image/jpeg':
                return $this->normalizeGdResource(imagecreatefromjpeg($imageFile));

            case 'image/gif':
                return $this->normalizeGdResource(imagecreatefromgif($imageFile));

            case 'image/png':
                return $this->normalizeGdResource(imagecreatefrompng($imageFile));
        }

        throw new Exception('GD resource not supported image extension');
    }
protected function getGdResource ( $ imageFile ) { $ imageInfo = getimagesize ( $ imageFile ) ; switch ( $ imageInfo [ 'mime' ] ) { case 'image/jpg' : case 'image/jpeg' : return $ this -> normalizeGdResource ( imagecreatefromjpeg ( $ imageFile ) ) ; case 'image/gif' : return $ this -> normalizeGdResource ( imagecreatefromgif ( $ imageFile ) ) ; case 'image/png' : return $ this -> normalizeGdResource ( imagecreatefrompng ( $ imageFile ) ) ; } throw new Exception ( 'GD resource not supported image extension' ) ; }
Creating a resource of GD image file
@param string $imageFile image file path
@return resource
@throws Exception
Creating a resource of GD image file