private function createImageResource()
    {
        // In case of failure, image will be false

        $mimeType = $this->getMimeTypeOfSource();

        if ($mimeType == 'image/png') {
            $image = imagecreatefrompng($this->source);
            if ($image === false) {
                throw new ConversionFailedException(
                    'Gd failed when trying to load/create image (imagecreatefrompng() failed)'
                );
            }
            return $image;
        }

        if ($mimeType == 'image/jpeg') {
            $image = imagecreatefromjpeg($this->source);
            if ($image === false) {
                throw new ConversionFailedException(
                    'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)'
                );
            }
            return $image;
        }

        /*
        throw new InvalidInputException(
            'Unsupported mime type:' . $mimeType
        );*/
    }
private function createImageResource()
    {
        // In case of failure, image will be false

        $mimeType = $this->getMimeTypeOfSource();

        if ($mimeType == 'image/png') {
            $image = imagecreatefrompng($this->source);
            if ($image === false) {
                throw new ConversionFailedException(
                    'Gd failed when trying to load/create image (imagecreatefrompng() failed)'
                );
            }
            return $image;
        }

        if ($mimeType == 'image/jpeg') {
            $image = imagecreatefromjpeg($this->source);
            if ($image === false) {
                throw new ConversionFailedException(
                    'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)'
                );
            }
            return $image;
        }

        /*
        throw new InvalidInputException(
            'Unsupported mime type:' . $mimeType
        );*/
    }
private function createImageResource ( ) { // In case of failure, image will be false $ mimeType = $ this -> getMimeTypeOfSource ( ) ; if ( $ mimeType == 'image/png' ) { $ image = imagecreatefrompng ( $ this -> source ) ; if ( $ image === false ) { throw new ConversionFailedException ( 'Gd failed when trying to load/create image (imagecreatefrompng() failed)' ) ; } return $ image ; } if ( $ mimeType == 'image/jpeg' ) { $ image = imagecreatefromjpeg ( $ this -> source ) ; if ( $ image === false ) { throw new ConversionFailedException ( 'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)' ) ; } return $ image ; } /*
        throw new InvalidInputException(
            'Unsupported mime type:' . $mimeType
        );*/ }
Create Gd image resource from source

@throws  InvalidInputException  if mime type is unsupported or could not be detected
@throws  ConversionFailedException  if imagecreatefrompng or imagecreatefromjpeg fails
@return  resource  $image  The created image
Create Gd image resource from source