loosen perms for fpm

By checking permissions of the target directory before uploading the pictures, you save yourself a lot of trouble. But asking for 777 is maybe too much in environments when php runs as the same user as the owner of the files (fastcgi, fpm, suexec, suphp, etc...), so here is a way to check this first