A simple approach might be to retheme the gender field itself so that it displays an image based upon its value, eg, instead of displaying male, it displays an image with path sites/default/files/male.png.
In D6, this would mean copying CCK's content-field.tpl.php to your theme directory and then creating content-field-field_gender.tpl.php and jiggering things up in there, eg...
print theme('image', 'sites/default/files/' . $item['view'] . '.png')
...instead of just print $item['view'].
My quick look at D7 here suggests that copying Field's field.tpl.php to field--gender--profile.tpl.php in your theme's directory would be basic starting point there and instead of render()ing $item, doing something similar with its value.
Then, in either version, just make sure you have three images in your files directory called male.png, female.png and unknown.png (or files based upon whatever the values of your gender field are.)
With this approach, you only have three files to deal with instead of a file uploaded and stored for each and every user. Another side benefit is that they will be easily cached by your users' browsers.
ADDITION:
Based upon new info from comments and other answers, you could do something like this in your user-picture.tpl.php template:
if (!empty($account->field_profile_picture[LANGUAGE_NONE][0]['fid'])) { // Load the file $file = file_load($account->field_profile_picture[LANGUAGE_NONE][0]['fid']); // Note the style name is "profile_picture" as explained in your question, // not "profile_pic" which was in your original code echo theme('image_style', array('style_name' => 'profile_picture', 'path' => $file->uri)); } else { $file_path = 'sites/default/files/' . $account->field_gender[LANGUAGE_NONE][0]['value'] . '.png'; echo theme('image_style', array('style_name' => 'profile_picture', 'path' => $file_path)); }
where the new stuff is the else .... Pardon my D6ism if sites/default/files is wrong in D7, but basically you just want a path on your system to where you've stuck male.png, female.png and unknown.png and you display them when your profile_picture field is not set.