Merged your other threads into one, then deleted the duplicate and triplicate messages.
1.) You kind of already have it. this line:
$imgPath = 'images/webimages/internal/' . $imgName;
stores the path into the variable. So now it's just a matter of defining where (from the document root) the "images" folder is:
$fullPath = 'http://www.mydomain.com/'.$imgPath;
2.) if you remove the "null" from the second argument in the imagejpeg() call, and replace that with your $imgPath, it will be saved there instead of output onto the screen. Just make sure that the path you pass as the second argument, is relative to the current script location:
imagejpeg($img, '/username/public_html/'.$imgPath, 100);
Two other things to note:
1.) You use a quality of 100. This can bloat your image size, and many of them at that quality can slow down your page. A quality of 80 is known to give just as good a quality as 100, but with about 1/3 the size. Just a suggestion.
2.) You have a parse error. You need to escape all single quotes when you use single quotes in echo(), print(), die(), or exit() statements. So this:
or die ('Couldn't copy');
should be this:
or die ('Couldn\'t copy');