Hi
I have some problèmes with the CCK image field module. This is not because of the module, but because of the core file_create_url() function.
I explain:
<?php
function file_create_url($path) {
// Strip file_directory_path from $path. We only include relative paths in urls.
if (strpos($path, file_directory_path() . '/') === 0) {
$path = trim(substr($path, strlen(file_directory_path())), '\\/');
}
switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
case FILE_DOWNLOADS_PUBLIC:
return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
case FILE_DOWNLOADS_PRIVATE:
return url('system/files/'. $path, NULL, NULL, TRUE);
}
}
?>
This give me an asbolute URL because of the use of $GLOBALS['url'].
If we look at the url() function, we have a boolean parameter $absolute, which is default setted to FALSE.
If false is selected, , the method use base_path() as base for the url, else it uses the global $base_url.
Is this normal that drupal devs made the choice of always put absolute URL for files ?
Is this a bug ?
If not, why ?
The problem for me is that I use drupals behind proxies (they are in a company LAN, using internal DNS which
are not accessible from outside). When giving absolute pathes, the site give me, through the proxy an internal
DNS which does not work.