From 6e7c71db77fc68b7c3d1149b830a838b81cdb718 Mon Sep 17 00:00:00 2001 From: "yogg@epsina.com" Date: Sun, 31 Jan 2016 18:28:09 +0100 Subject: Add update_image and download_image --- server/core/Image.php | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'server/core') diff --git a/server/core/Image.php b/server/core/Image.php index c9d9845..a986a40 100644 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -67,18 +67,24 @@ class Image { return $image; } - + /** + * Details about an image + * + * @param string $id + * id of the image + * + * @param array $opt + * options for the image creation + **/ public function update_image($id, array $opt){ $service = $this->oidentity; - - //OPTIONS A VOIR $image = $service->getImage($id); $image->update([ - 'minDisk' => 1, - 'minRam' => 1, - 'name' => $opt[name], - 'protected' => false, - 'visibility' => $opt[visibility], + 'minDisk' => $opt['minDisk'], + 'minRam' => $opt['minRam'], + 'name' => $opt['name'], + 'protected' => $opt['protected'], + 'visibility' => $opt['visibility'], ]); return $image; @@ -135,11 +141,17 @@ class Image { $image->uploadData($stream); } - // RETOUR A VOIR - public function download_image($id){ + /** + * Download an image + * + * @param string $id + * identifier of the image + */ + public function download_image($id){ $service = $this->oidentity; $image = $service->getImage($id); $stream = $image->downloadData(); + return $stream; } } ?> -- cgit v1.2.3