Implemented saving pictures to the gallery.
Improved the error handling logic.
Implemented saving to external directories.