Fixed the issues with empty folder and to read only images

Now this supports images of type jpg, jpeg and png only. If there are
other types of documents in the folder, they will be left.