Permissions on newly created images are set to rw-------

The problem:

Once an images has been 'Smushed', file_put_contents() creates a temporary file. This file creation gives the new file only user permissions - meaning no one else apart from that user can see the file. The result: no images viewable in the browser.

I have done extensive tests to see where the problem occurs on my system and it is as written above.

Can you please update the source code to check for perms after file_put_contents()and execute chmod() if they don't match the original file please?

wp-smush.php - line 192

//Add the file as tmp
file_put_contents( $tempfile, $response['data']->image );

$fileperms  = fileperms ( $file_path );
$tempfileperms = fileperms ( $tempfile );

if( $fileperms !== $tempfileperms ) {
     chmod( $tempfile, $fileperms);

That would be really helpful.

Thank you