add htmlt file api to generate dataurl and image preview
convert image data url to binary file
get right dimensions for different size of images
Merge pull request #484 from happypeter/preview_before_upload

Preview before upload