aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2012-06-06 22:10:09 +0200
committerBartek Przybylski <bart.p.pl@gmail.com>2012-06-06 22:13:49 +0200
commitaa0fc3c69a9a92cd041c329bf228ba6d30daff20 (patch)
treedaed71dc0b3a13d605e13c25cf406cc92896c7e5
parent671fe4980939841d15c642bad4957c223931aa1f (diff)
downloadnextcloud-server-aa0fc3c69a9a92cd041c329bf228ba6d30daff20.tar.gz
nextcloud-server-aa0fc3c69a9a92cd041c329bf228ba6d30daff20.zip
aviod incorrect image size returning in gallery listing
-rw-r--r--apps/gallery/lib/managers.php7
-rw-r--r--apps/gallery/templates/index.php18
2 files changed, 14 insertions, 11 deletions
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php
index 6cb9b420ac6..2444659d0a4 100644
--- a/apps/gallery/lib/managers.php
+++ b/apps/gallery/lib/managers.php
@@ -32,9 +32,10 @@ class DatabaseManager {
\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()));
- unset($image);
\OCP\DB::commit();
- return $this->getFileData($path);
+ $ret = array('filepath' => $path, 'width' => $image->width(), 'height' => $image->height());
+ unset($image);
+ return $ret;
}
private function __construct() {}
@@ -93,4 +94,4 @@ class ThumbnailsManager {
private function __construct() {}
}
-?> \ No newline at end of file
+?>
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index 3dc722f0666..39e3bbf47b3 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -42,7 +42,7 @@ function o(element) {
function openNewGal(album_name) {
root = root + album_name + "/";
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;
}
@@ -85,13 +85,15 @@ for($i = 0; $i < count($images); $i++) {
$dir_arr = explode('/', $previous_element);
-if (count($dir_arr)==0) {
- $tl->addTile(new \OC\Pictures\TileSingle($previous_element));
-} else if (count($dir_arr) && $ts->getCount() == 0){
- $ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]);
-} else {
- $arr[] = $previous_element;
- $ts->addTile($arr);
+if (count($images)>1) {
+ if (count($dir_arr)==0) {
+ $tl->addTile(new \OC\Pictures\TileSingle($previous_element));
+ } else if (count($dir_arr) && $ts->getCount() == 0){
+ $ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]);
+ } else {
+ $arr[] = $previous_element;
+ $ts->addTile($arr);
+ }
}
if ($ts->getCount() != 0) {