From 394a4756d85d1a1448a1475c297fc69c20824d0d Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Thu, 15 Jan 2009 16:08:17 -0500 Subject: [PATCH] this code was making incorrect assumptions about my directory layout. This 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 74a4a3ef7..d36ff0af0 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -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); } /** -- 2.11.0