While I won't say this is "good advice" (definitely not BCP), have you checked out variable variables?
for ($i = 1; $i <= $nr_of_pics; ++$i) {
$image = 'name_image' . $i;
if (!isset($$image)) continue; // error checking
rename($temp_img_path.$$image, $new_img_path.'thumbs/'.$$image);
}
Note: that snippet makes the assumption that the image numbers start at "1" like you said in your post, instead of "0" where your code started; if this is not the case, change the first line back to:
for ($i = 0; $i < $nr_of_pics; ++$i) {
The problem with your snippet is that $name_image[$i] is the syntax to access the element at index $i in an array named $name_image, which you have not defined. The only way to access a variable without "knowing it's name" at code-time is to use a variable variable, which as the manual will explain, evaluates the contents of the rightmost variable (that is, the contents of $image in $$image) as the name of a variable it should access.
I was going to post a long winded explantion here, but the manual entry should make good sense.