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

aaron’s picture

base_path() would be a better replacement.

Scheepers de Bruin’s picture

Kewl, thanks guys!

I've changed the line in painter_op_load_image to read:

$filename = ltrim($args['filename'], '/');

Scheepers de Bruin’s picture

Status: Active » Fixed

In painter.module: painter_op_load_image changed:

$filename = $_SERVER['DOCUMENT_ROOT'].$args['filename'];

to

$filename = ltrim($args['filename'], '/');

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Scheepers de Bruin’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.