1. Bug #0000458: Scale image quality setting is incorrect for PNG images
2. Function "imagepng" has "compression" as 2nd parameter, but "imagejpg" has "quality" as 2nd parameter. That lead to imagepng being given worst quality setting in result.
INP-383