Optimize Images

From #6232.

Includes manual image optimization and automatic compression for user-generated files.