From 249b98311e89e7e47392a8cba2b3bb6d0a835ff0 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 24 Nov 2017 20:13:45 -0800 Subject: [PATCH] Added getOriginalFiles() to Image --- app/Models/Image.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Models/Image.php b/app/Models/Image.php index 2c9c2c2c..dfa0bf29 100644 --- a/app/Models/Image.php +++ b/app/Models/Image.php @@ -154,6 +154,21 @@ class Image extends Model } } + /** + * Finds the names of all the original-sized images uploaded to the server + * @return string[] + */ + public static function getOriginalFiles() { + $rv = array(); + + //We use a cursor to cut down on memory + foreach (Image::cursor() as $image) { + $rv[] = $image->getFile(Image::ORIGINAL); + } + + return $rv; + } + protected $table = 'images'; public function getUrl($type = self::NORMAL)