From ef8751468b998baddbc6d5827a392ed6e12e5548 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 25 Sep 2010 13:27:35 -0700 Subject: Base64 encode the data result if the encoding param is set to "base64". Fixes #1400. --- modules/gallery/helpers/data_rest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers/data_rest.php') diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php index 98c98894..791de9c0 100644 --- a/modules/gallery/helpers/data_rest.php +++ b/modules/gallery/helpers/data_rest.php @@ -72,7 +72,12 @@ class data_rest_Core { header("Content-Type: {$item->mime_type}"); } Kohana::close_buffers(false); - readfile($file); + + if (isset($p->encoding) && $p->encoding == "base64") { + print base64_encode(file_get_contents($file)); + } else { + readfile($file); + } // We must exit here to keep the regular REST framework reply code from adding more bytes on // at the end or tinkering with headers. -- cgit v1.2.3