Skip to content
Snippets Groups Projects
Commit 9dbb07b8 authored by Thomas Tanghus's avatar Thomas Tanghus
Browse files

Added data() method to OC_Image to return raw image data.

parent 301a14dc
No related branches found
No related tags found
No related merge requests found
......@@ -187,15 +187,22 @@ class OC_Image {
}
/**
* @returns Returns a base64 encoded string suitable for embedding in a VCard.
* @returns Returns the raw image data.
*/
function __toString() {
function data() {
ob_start();
$res = imagepng($this->resource);
if (!$res) {
OC_Log::write('core','OC_Image->__toString. Error writing image',OC_Log::ERROR);
OC_Log::write('core','OC_Image->data. Error getting image data.',OC_Log::ERROR);
}
return base64_encode(ob_get_clean());
return ob_get_clean();
}
/**
* @returns Returns a base64 encoded string suitable for embedding in a VCard.
*/
function __toString() {
return base64_encode($this->data());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment