Anytime you change file permissions to allow anyone to update you run a risk. However Gallery will not function unless you do.
And I have not heard of anyone having any problems with their images being hacked.
You would make the files 666 and the theme folder 777. But I wouldn't do it. Edit it on your own machine and upload it. No sense in giving someone the possibility to screw up your template.