if i follow you, you could change the permissions of anything being generated or handeled by your script, assuming your script was in a group with permission.....
so,
<?php
$pic=ImageCreate(600,600);
chmod ("$pic", 0777);
echo "<img src=\"$pic\" width=\"600\" height=\"600\">";
?>
this script makes the image, then gives everyone read, write, execute permissions on it. If you tried the following:
<?php if (isset($delete_file) {
imagedestroy ($file_to_delete); } ?>
and the $file_to_delete had an "owner" in a different group then your script, you would only be able to delete it if the "other" permissions were @ least read-write.
reading your first post again, i still don't see why you might want to change the permissions back and forth but, i hope that helps.
chmod can actually be a bear to understand. following are a couple good links for unix file systems:
http://dapsas.weizmann.ac.il/UNIXhelp/Pages/tasks/access_permissions.html
http://www.developerschoice.net/faq/unix/chmod.html
nick