Edit Image/Image Details – Replace button missing

Not sure how you dynamically populate content into WordPress.

To get the Edit Image Button the image must be in the Media. Make sure the image has a class="wp-image-{ID}" where {ID} has to be the right maching id of the image you can find via media content. Or while inserting the image and have a look at the source code then you will find that class with the right {ID}