A regex could provide a simple solution:
var img_regex = /(https?:\/\/([a-z0-9\/\._-])+\.(?:jpe?g|gif|png))/gi; var post_content = post_content.replace(img_regex, '<img src="$1">');
But this doesn't check if it is a valid image. Also would need to apply ZoomableImage.
Regex fails on the image I provided in the bounty. Extensions are hints and conventions but are often not present.
reply