Photos and album contents are now physically deleted from disk

This commit is contained in:
Andy Heathershaw
2016-09-09 11:09:03 +01:00
parent 71f6ed8979
commit 504134caa7
6 changed files with 91 additions and 5 deletions
+19
View File
@@ -118,6 +118,25 @@ class PhotoService
$this->regenerateThumbnails($originalPhotoResource);
}
public function delete()
{
// Remove all thumbnails first - so if any fail, we don't delete the original
$themeInfo = $this->themeHelper->info();
$thumbnailsRequired = $themeInfo['thumbnails'];
/** @var mixed $thumbnail */
foreach ($thumbnailsRequired as $thumbnail)
{
$this->albumSource->deleteThumbnail($this->photo, $thumbnail['name']);
}
// Next remove the original photo
$this->albumSource->deleteThumbnail($this->photo);
// Finally remove the database record
$this->photo->delete();
}
public function regenerateThumbnails($originalPhotoResource = null)
{
if (is_null($originalPhotoResource))