Fix adding of images from camera

There were still some problems with adding images from camera, this will hopefully fix them. I also ran automatic code cleanup in Eclipse.