Yes, it saves it and displays it in the <img> tag afterwards. If you take the code I posted above and put your own fixed images in there, you can see that it works. Then uncomment line 101 and comment line 102. That's when it stops working for me.
One other thing to look at is $pfile = "
http://www.motorvatorads.com/staging/temp_images/" . $rowph[2]; I don't think you can do a 'write' that way because you can't get 'PUT' privileges on the web server with a full URL like that. If you can use a 'relative' url and write the file in the directory the script is in, that might work. $pfile = "staging/temp_images/" . $rowph[2]; might also work since it doesn't have the 'http' in front of it. 'http' makes it a different 'method'.
"<? (short open tag)" is fine as long as it is working for you. I have several sites that I maintain that are written that way. But now you know if you change servers and your PHP stops working. "<? (short open tag)" is not compatible with the XML tag because it starts off the same: <? xml". That was the reason for the change.