You are here

function _pathologic_do_src in Pathologic 6

Same name and namespace in other branches
  1. 5 pathologic.module \_pathologic_do_src()
  2. 6.2 pathologic.module \_pathologic_do_src()

Return a formatted SRC attribute.

You might think SRC attributes will always be disk files instead of Drupal paths, but that's not always the case - Imagecache relies on file paths actually being Drupal paths, at least initially. preg_replace_callback() callback function.

1 string reference to '_pathologic_do_src'
pathologic_filter in ./pathologic.module
Implementation of hook_filter().

File

./pathologic.module, line 144
The main and only module file.

Code

function _pathologic_do_src($matches) {
  if (file_exists($matches[1])) {
    global $base_url;
    return "src=\"{$base_url}/{$matches[1]}\"";
  }
  return 'src="' . _pathologic_url($matches[1]) . '"';
}