There's a program called imagemagick that can edit images.
It can save files to my home folder with out issues.
It won't save images to a folder /var/www/thumb_nails/
edit: it does work if I execute the script I have the command in. It just wont work when apache2 uses the script... very strange...
www-data
to address this.