this code was making incorrect assumptions about my directory layout. This
authorChuck Hagenbuch <chuck@horde.org>
Thu, 15 Jan 2009 21:08:17 +0000 (16:08 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Thu, 15 Jan 2009 21:08:17 +0000 (16:08 -0500)
should be a little better, but ideally we'd pass the same parameters to
base64ImgData() that we pass to Horde::img (app, image) so that it can figure
out the path reliably.

imp/lib/IMP.php

index 74a4a3e..d36ff0a 100644 (file)
@@ -1735,8 +1735,8 @@ class IMP
      */
     public function base64ImgData($file)
     {
-        return 'data:image/' . substr($file, strrpos($file, '.') + 1) . ';base64,' .
-            base64_encode(file_get_contents(dirname(realpath($GLOBALS['registry']->get('fileroot', 'horde'))) . $file));
+        $data = file_get_contents(realpath($GLOBALS['registry']->get('fileroot', 'horde')) . preg_replace('/^' . preg_quote($GLOBALS['registry']->get('webroot', 'horde'), '/') . '/', '', $file));
+        return 'data:image/' . substr($file, strrpos($file, '.') + 1) . ';base64,' . base64_encode($data);
     }
 
     /**