Only save if the file has changed

This commit is contained in:
Michiel Sikma
2017-11-10 21:13:16 +01:00
parent 86cc43dfdd
commit f37fcb38ec

View File

@@ -30,7 +30,9 @@ foreach ($imgs as $path => $img) {
imagealphablending($i, false);
imagesavealpha($i, true);
$changed = change_color($i);
imagepng($i, $new_name, 9);
if ($changed) {
imagepng($i, $new_name, 9);
}
print('img: '.$path.' (changed: '.($changed === true ? 'T' : 'F').')'.PHP_EOL);
}