summaryrefslogtreecommitdiffstats
path: root/lib/private/avatar.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-11-22 23:57:23 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-11-22 23:57:23 +0100
commit6085878966e44ff53d1d088ae6776ebfba70ff72 (patch)
treeeb114e4ad7057ec90fc7060312e79533655a0fc0 /lib/private/avatar.php
parent6fdce3b7e92a5c93134719cd2d4934a73f943e02 (diff)
downloadnextcloud-server-6085878966e44ff53d1d088ae6776ebfba70ff72.tar.gz
nextcloud-server-6085878966e44ff53d1d088ae6776ebfba70ff72.zip
Avatar: accept OC_Image as in setParameter
Diffstat (limited to 'lib/private/avatar.php')
-rw-r--r--lib/private/avatar.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/avatar.php b/lib/private/avatar.php
index 814a9b22bed..e97f55eecaf 100644
--- a/lib/private/avatar.php
+++ b/lib/private/avatar.php
@@ -44,15 +44,19 @@ class OC_Avatar implements \OCP\IAvatar {
/**
* @brief sets the users avatar
- * @param $data mixed imagedata or path to set a new avatar
+ * @param $data mixed OC_Image, imagedata or path to set a new avatar
* @throws Exception if the provided file is not a jpg or png image
* @throws Exception if the provided image is not valid
* @throws \OC\NotSquareException if the image is not square
* @return void
*/
public function set ($data) {
-
- $img = new OC_Image($data);
+ if($data instanceOf OC_Image) {
+ $img = $data;
+ $data = $img->data();
+ } else {
+ $img = new OC_Image($data);
+ }
$type = substr($img->mimeType(), -3);
if ($type === 'peg') {
$type = 'jpg';