mixersoft / WMS

Workorder Management System
1 stars 0 forks source link

Undefined index: dirname [APP\Config\bootstrap.php, line 209] #23

Closed maurozadu closed 11 years ago

maurozadu commented 11 years ago

the line is:

return $path_parts['dirname'].'/'.$asset_basename;

for now I've placed an @ symbol after the return so the error is not shown and I can work, but this is a temporary hack

mixersoft commented 11 years ago

can you show me the output from here:

public static function getImageSrcBySize($relpath, $prefix) {
    if (strlen($prefix)==2) $prefix .= '~';
    $regexp = '/^(sq|br|bp|cr|ax|bs|bx|ap|as|ar|tn|bm|am)~/';
    $path_parts = pathinfo($relpath);
  debug($path_parts);       
    // replace existing prefix, if any, and then prepend
    if (preg_match($regexp, $path_parts['basename'])) {
        $asset_basename = preg_replace($regexp, $prefix, $path_parts['basename'], 1);
    } else {
        $asset_basename = $prefix.$path_parts['basename'];
    }
    return @$path_parts['dirname'].'/'.$asset_basename;
}
maurozadu commented 11 years ago

Here is a screenshot:

screen

Maybe the problem is because I don't have the images properly linked. I believe it doesn't really matters, as long as it works in your environment it's ok, right?

mixersoft commented 11 years ago

That's not what I asked for. Can you add this line to the code in bootstrap.php:

 $path_parts = pathinfo($relpath);
 debug($relpath);
 debug($path_parts);     

The reason I am concerned is because pathinfo() is a standard php method, and you are not getting the correct output. I am wondering if this is a php version problem. otherwise, it works for me, so it's ok if you can't see the images.

maurozadu commented 11 years ago

ok, now I got it.

debug($relpath); shows null

debug($path_parts);shows this array:

array(
    'basename' => '',
    'filename' => ''
)

so, I tink the problem is that the method is not receiving the right argument

maybe the problem is that I don't have the assets table with the proper json string that feeds this method. I asked for that table in issue #22 but I didn't understood your answer.

Thank you.

maurozadu commented 11 years ago

with the latest changes this is no longer a problem