Hi, first off thanks for the module.
In painter.module, the function painter_op_load_image() has the following line:
$filename = $_SERVER['DOCUMENT_ROOT'].$args['filename'];
But, using $_SERVER['DOCUMENT_ROOT'] is unreliable on some Apache configurations (specifically those using the 'VirtualDocumentRoot' directive). So the 'file_exists()' function that follows returns false.
I would suggest that the painter_op_load_image() function require the $args['filename'] parameter to always be passed as relative to the installation's root. Then you wouldn't have this problem. I believe that this is the standard Drupal way of doing things anyhow (see image.inc for example).
Now, I came to this point by trying the theme('logo',$logo) example. However the $logo string is actually an absolute URL (starts with a leading slash) so this would have to be either addressed in painter_op_load_image() or in the page.tpl.php file. My solution was:
in page.tpl.php
print theme('logo',ltrim($logo,'/'));
and in painter.module
$filename = $_SERVER['DOCUMENT_ROOT'].$args['filename'];
becomes
$filename = $args['filename'];
Let me know what you think
Comments
Comment #1
aaron commentedbase_path() would be a better replacement.
Comment #2
Scheepers de Bruin commentedKewl, thanks guys!
I've changed the line in painter_op_load_image to read:
$filename = ltrim($args['filename'], '/');
Comment #3
Scheepers de Bruin commentedIn painter.module: painter_op_load_image changed:
$filename = $_SERVER['DOCUMENT_ROOT'].$args['filename'];
to
$filename = ltrim($args['filename'], '/');
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
Scheepers de Bruin commented