How do the images get into the correct directory for my theme?
The images are uploaded through WordPress, meaning they’ll get put wherever WordPress decides to put them: normally, that’s the wp-content/uploads
directory.
What can I do for you to solve this?
The most useful thing would be to find the error that’s causing the 500 response.
Failing that, I suppose you could find out what gets sent when you successfully upload an image through WordPress:
* start editing a new post
* open the developer tools
* go to the network tab and make sure it’s recording network requests
* upload an image through WordPress — you should notice network requests when this happens
* save the network log and send it to me
But the actual error is likely to be extremely helpful, and it’ll probably be difficult to work out the problem without it.