aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/album.php19
-rw-r--r--lib/image.php13
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/album.php b/lib/album.php
index 87bb715f4..15450049a 100644
--- a/lib/album.php
+++ b/lib/album.php
@@ -138,4 +138,23 @@ class TidypicsAlbum extends ElggObject {
}
return $imageList[$key];
}
+
+ /**
+ * Remove an image from the album list
+ *
+ * @param int $imageGuid
+ * @return bool
+ */
+ public function removeImage($imageGuid) {
+ $imageList = $this->getImageList();
+ $key = array_search($imageGuid, $imageList);
+ if ($key === FALSE) {
+ return FALSE;
+ }
+
+ unset($imageList[$key]);
+ $this->setImageList($imageList);
+
+ return TRUE;
+ }
}
diff --git a/lib/image.php b/lib/image.php
index 4100f3f7b..c60eabfc0 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -18,6 +18,19 @@ class TidypicsImage extends ElggFile {
}
/**
+ * delete image
+ *
+ * @return bool
+ */
+ public function delete() {
+
+ $album = get_entity($this->container_guid);
+ $album->removeImage($this->guid);
+
+ return parent::delete();
+ }
+
+ /**
* Has the photo been tagged with "in this photo" tags
*
* @return true/false