sunzu
sunzu

Reputation: 106

OSX with XAMPP: "imagegd2(): unable to open temporary file"

I get "imagegd2(): unable to open temporary file" error message when I go to an image URL that is generated with imagegd2() like:

$image->make($data['path']);
$image->resize(100, null, true)->crop(70, 70);
// create response and add formated image
$response = Response::make($image->encode('png'));
// set content-type
$response->header('Content-Type', 'image/png');

It is related with permissions and OSX, as in linux dev environment works fine.

Upvotes: 2

Views: 2782

Answers (1)

sunzu
sunzu

Reputation: 106

I found the problem, Mac OSx temporary folder is something similar to: /var/folders/6l/zy7_vl5n5kq8wbv00bvzc15h0000gn/T/

Check your temporary folder in terminal:

echo $TMPDIR

An give read, write and execution permissions or 777 to that folder, not only 755:

chmod -R 777 [your_tmp_folder]

That's all!

Upvotes: 6

Related Questions