Skip to content
This repository was archived by the owner on Jun 9, 2019. It is now read-only.
This repository was archived by the owner on Jun 9, 2019. It is now read-only.

PHP 5.1.6 w/ GD 2.0.28 does not like NULL 2nd param to imagejpeg #2

@dbennett455

Description

@dbennett455

I get an error when the second parameter passed to imagejpeg is NULL.

Unable to open '' for writing in ...

I worked around the issue by changing the switch statement at the bottom:

{

Writing image according to type to the output destination

switch ( $info[2] ) {
case IMAGETYPE_GIF: ($output == NULL) ? imagegif($image_resized) : imagegif($image_resized, $output); break;
case IMAGETYPE_JPEG: ($output == NULL) ? imagejpeg($image_resized) : imagejpeg($image_resized, $output); break;
case IMAGETYPE_PNG: ($output == NULL) ? imagepng($image_resized) : imagepng($image_resized, $output); break;
default: return false;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions