Added a check that if the gallery folder does not exist then it is
created.