From what I can tell, your curl command is good. It's uploading the files, right? It works in my testing for sure.
I think the problem is in your grep commands. Try running it without the greps, and storing the output in a file. From there, you can play with different ways of parsing the output without trying an actual upload every time.
- In my output, the 'original' url is in an "<original_image>" tag, as opposed to the "<original> that you used in your script.
- The parenthesis around the dot are not necessary, and may also be part of the problem
Try this, in place of the two greps:
grep -Eo "<orig[^<]*" | sed 's/<.*>//g'
As for your second question, in my test I simply replaced 1, 2, and 3.jpg with *.jpg
This should work on every .jpg in the current working directory.
I hope this helps!