Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve the file extension in the temporary file #47

Closed
wants to merge 1 commit into from

Conversation

leofeyer
Copy link
Member

This will prevent the following error:

Imagine\Exception\InvalidArgumentException: Saving image in "tmp" format is not supported, please use one of the following extensions: "gif", "jpeg", "png", "wbmp", "xbm"

See https://ci.appveyor.com/project/leofeyer/image/build/1.0.128

@@ -111,7 +111,7 @@ protected function executeResize(ImageInterface $image, ResizeCoordinatesInterfa
}

// Atomic write operation
$tmpPath = $this->filesystem->tempnam($dir, 'img');
$tmpPath = sys_get_temp_dir().'/'.basename($path);
$imagineImage->save($tmpPath, $imagineOptions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using the following code instead?

$imagineImage->save($tmpPath, $imagineOptions + [
    'format' => strtolower(pathinfo($path, PATHINFO_EXTENSION)),
]);

Then we could keep the filesystem->tempnam() call.

@ausi
Copy link
Member

ausi commented Sep 20, 2018

Fixed in 55a770a

@ausi ausi closed this Sep 20, 2018
@ausi ausi deleted the fix-format-not-supported branch September 20, 2018 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants