Skip to content

Instantly share code, notes, and snippets.

Created September 21, 2016 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1ac153e1fcf780e00a99d83a1da9bd0b to your computer and use it in GitHub Desktop.
Save anonymous/1ac153e1fcf780e00a99d83a1da9bd0b to your computer and use it in GitHub Desktop.
demo for bountify
$content = preg_replace_callback("/\<img.+src=[\"|\'](?!https?:\/\/)([^\/].+?)[\"|\']/",
function($matches) {
$match = $matches[0];
$capturedImgPath = $matches[1];
$fixedImgPath = '/content/'.$this->path.'/images/'.$capturedImgPath;
return str_replace($capturedImgPath, $fixedImgPath, $match);
}, $content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment