Thanks for your reply. I tried some way, maybe the problem is at my end, but could not get it work.
Surface_save works well on windows.exe (but not with html5), however buffer_get_surface+buffer_save or buffer_get_surface+buffer_base64_encode+file_text_write_string did not work at all.
Anyway, thank you.