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;
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;
}