diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-10 13:04:42 +0200 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-10 13:05:00 +0200 |
commit | 76f20eb57c4089b51ee506a000a21ab95727da43 (patch) | |
tree | d2588cdabada5854cc9c6670836470013c058460 /apps/gallery/lib | |
parent | f90c8738ab79a6fc76d9482f44a199963fb27ba1 (diff) | |
download | nextcloud-server-76f20eb57c4089b51ee506a000a21ab95727da43.tar.gz nextcloud-server-76f20eb57c4089b51ee506a000a21ab95727da43.zip |
fix first time image loading error
Diffstat (limited to 'apps/gallery/lib')
-rw-r--r-- | apps/gallery/lib/managers.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php index f9a67b8b117..9a2dbd3bae2 100644 --- a/apps/gallery/lib/managers.php +++ b/apps/gallery/lib/managers.php @@ -26,10 +26,8 @@ class DatabaseManager { if (!$image->loadFromFile($path)) { return false; } - \OCP\DB::beginTransaction(); $stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)'); $stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height())); - \OCP\DB::commit(); $ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height()); unset($image); return $ret; @@ -78,9 +76,14 @@ class ThumbnailsManager { public function getThumbnailInfo($path) { $arr = DatabaseManager::getInstance()->getFileData($path); + if (!$arr) { + $thubnail = $this->getThumbnail($path); + unset($thubnail); + $arr = DatabaseManager::getInstance()->getFileData($path); + } $ret = array('filepath' => $arr['path'], - 'width' => $arr['width'], - 'height' => $arr['height']); + 'width' => $arr['width'], + 'height' => $arr['height']); return $ret; } |