It is not possible without sending a new request to the server. In other words you have to update the page.
But there are different ways to do this.
The simpliest I think is if you can upload the page when you click the image and process the code on reload.
Or if you don't have to show any new information on the main page. You can open a new page that process the code and then closes it self.
Another way to handle this is to have the picture embeded with ex <iform>. And when you click on the image only the embeded page will reload.
I hope this will help you?
// mattis