I tried the code below, but it doesn't seem to be working. Is it possible to dynamically achieve this? If yes, how can I do it? I initially used the og:image meta tag, but it didn't work due to browsers not reading JavaScript. Any assistance would be appreciated.
<link rel="image_src" href="" id="ShareImageID"/>
<script>
var ShareImageIdVar = location.href.match(/\d+/);
document.getElementById('ShareImageID').href = "http://www.mysite.com/Images/"+ ShareImageIdVar +".jpg";
</script>
The concept is that Facebook will always search for
<link rel="image_src" href="" id="ShareImageID"/>
and utilize the image link within the href as the primary display. However, if it's unable to find it, it will select a random image instead.