#1965 - Improve sanity checks and copy/convert/process logic for rotate and resize.
- resize: ensured that resize is skipped *only* if the metadata is valid or the options are well-defined and would upscale. Then, if resize is skipped, check to see if it still needs to be converted. Previous conditions would allow a small PNG to get copied to a JPG, and would allow a corrupted JPG to be copied to the output.
- rotate: add checks for empty file or empty options.
- use get_file_metadata instead of direct getimagesize call.
- add unit tests for rotate and resize, including some for corrupted input files and missing options.