fix first time image loading error
This commit is contained in:
parent
f90c8738ab
commit
76f20eb57c
|
@ -26,10 +26,8 @@ class DatabaseManager {
|
||||||
if (!$image->loadFromFile($path)) {
|
if (!$image->loadFromFile($path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
\OCP\DB::beginTransaction();
|
|
||||||
$stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
|
$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()));
|
$stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height()));
|
||||||
\OCP\DB::commit();
|
|
||||||
$ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height());
|
$ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height());
|
||||||
unset($image);
|
unset($image);
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -78,9 +76,14 @@ class ThumbnailsManager {
|
||||||
|
|
||||||
public function getThumbnailInfo($path) {
|
public function getThumbnailInfo($path) {
|
||||||
$arr = DatabaseManager::getInstance()->getFileData($path);
|
$arr = DatabaseManager::getInstance()->getFileData($path);
|
||||||
|
if (!$arr) {
|
||||||
|
$thubnail = $this->getThumbnail($path);
|
||||||
|
unset($thubnail);
|
||||||
|
$arr = DatabaseManager::getInstance()->getFileData($path);
|
||||||
|
}
|
||||||
$ret = array('filepath' => $arr['path'],
|
$ret = array('filepath' => $arr['path'],
|
||||||
'width' => $arr['width'],
|
'width' => $arr['width'],
|
||||||
'height' => $arr['height']);
|
'height' => $arr['height']);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue