diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-09-25 13:27:35 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-09-25 13:27:35 -0700 |
commit | ef8751468b998baddbc6d5827a392ed6e12e5548 (patch) | |
tree | 85766ce290f3a89b1039969ce31bc47138d76594 | |
parent | 85637a08265cbfef3cc615724b22195439f5afa5 (diff) |
Base64 encode the data result if the encoding param is set to "base64".
Fixes #1400.
-rw-r--r-- | modules/gallery/helpers/data_rest.php | 7 |
1 files changed, 6 insertions, 1 deletions
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. |