aviod incorrect image size returning in gallery listing

This commit is contained in:
Bartek Przybylski 2012-06-06 22:10:09 +02:00
parent 671fe49809
commit aa0fc3c69a
2 changed files with 14 additions and 11 deletions

View File

@ -32,9 +32,10 @@ class DatabaseManager {
\OCP\DB::beginTransaction(); \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()));
unset($image);
\OCP\DB::commit(); \OCP\DB::commit();
return $this->getFileData($path); $ret = array('filepath' => $path, 'width' => $image->width(), 'height' => $image->height());
unset($image);
return $ret;
} }
private function __construct() {} private function __construct() {}
@ -93,4 +94,4 @@ class ThumbnailsManager {
private function __construct() {} private function __construct() {}
} }
?> ?>

View File

@ -42,7 +42,7 @@ function o(element) {
function openNewGal(album_name) { function openNewGal(album_name) {
root = root + album_name + "/"; root = root + album_name + "/";
var url = window.location.toString().replace(window.location.search, ''); var url = window.location.toString().replace(window.location.search, '');
url = url + "?app=gallery&root="+root; url = url + "?app=gallery&root="+encodeURIComponent(root);
window.location = url; window.location = url;
} }
@ -85,13 +85,15 @@ for($i = 0; $i < count($images); $i++) {
$dir_arr = explode('/', $previous_element); $dir_arr = explode('/', $previous_element);
if (count($dir_arr)==0) { if (count($images)>1) {
$tl->addTile(new \OC\Pictures\TileSingle($previous_element)); if (count($dir_arr)==0) {
} else if (count($dir_arr) && $ts->getCount() == 0){ $tl->addTile(new \OC\Pictures\TileSingle($previous_element));
$ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]); } else if (count($dir_arr) && $ts->getCount() == 0){
} else { $ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]);
$arr[] = $previous_element; } else {
$ts->addTile($arr); $arr[] = $previous_element;
$ts->addTile($arr);
}
} }
if ($ts->getCount() != 0) { if ($ts->getCount() != 0) {