Fixed an issue with image data uri to file. Previous solution didn't work when the server is set to allow_url_fopen=0 so used a work around.

Also added unlink file to remove it upon deletion from the database.

Better, cleaner fixes for #2