added support for deleting files, fixed a bug where images would exceed page border