Last year a Google Code-in student implemented photo uploading for our webchat. This currently uploads to a Python-based HTTP service which creates photo thumbnails on the server side.
Since then, XEP-0363 has become the standard way to upload photos in chat however this only hosts files, it does not generate preview thumbnails for them. To support this, you can use a HTML5 Canvas to scale the image and then send it as a data url
There is a separate task to change the uploading to XEP-0363.