modified from beta1
fix beta1
fix freemarker
add file upload with resize images