summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGeorg Ehrke <georg.stefan.germany@googlemail.com>2011-10-22 13:12:13 +0200
committerGeorg Ehrke <georg.stefan.germany@googlemail.com>2011-10-22 13:12:13 +0200
commit0011c42669078b37ded670f2ff30e69e26df3282 (patch)
treeee4901db737669c816b1c276f7bce72fd5951190 /apps
parent268e667bef3bd06f10638aa33b6dc7fa2ef6d796 (diff)
parent7761765a4b018f41c945946693226f8b5a99487c (diff)
downloadnextcloud-server-0011c42669078b37ded670f2ff30e69e26df3282.tar.gz
nextcloud-server-0011c42669078b37ded670f2ff30e69e26df3282.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud into fullcalendar
Diffstat (limited to 'apps')
-rw-r--r--apps/gallery/ajax/getCovers.php8
-rw-r--r--apps/gallery/ajax/thumbnail.php17
-rw-r--r--apps/gallery/lib_scanner.php4
-rw-r--r--apps/media/css/player.css2
4 files changed, 20 insertions, 11 deletions
diff --git a/apps/gallery/ajax/getCovers.php b/apps/gallery/ajax/getCovers.php
index d84bf2a7903..b9c7558a53c 100644
--- a/apps/gallery/ajax/getCovers.php
+++ b/apps/gallery/ajax/getCovers.php
@@ -18,6 +18,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $
default:
exit();
}
+ if(!$myImage) exit();
$ratio_orig = $width_orig/$height_orig;
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
@@ -52,8 +53,11 @@ $targetImg = imagecreatetruecolor($numOfItems*$box_size, $box_size);
$counter = 0;
while (($i = $result->fetchRow()) && $counter < $numOfItems) {
$imagePath = OC::$CONFIG_DATADIRECTORY . $i['file_path'];
- CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size);
- $counter++;
+ if(file_exists($imagePath))
+ {
+ CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size);
+ $counter++;
+ }
}
header('Content-Type: image/png');
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php
index f24782390f6..a1416452932 100644
--- a/apps/gallery/ajax/thumbnail.php
+++ b/apps/gallery/ajax/thumbnail.php
@@ -5,6 +5,9 @@ OC_JSON::checkAppEnabled('gallery');
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSrc is a FILE - Returns an image resource.
//getting the image dimensions
+ if(! function_exists('imagecreatefromjpeg'))
+ OC_Log::write('gallery','GD module not installed',OC_Log::ERROR);
+
list($width_orig, $height_orig) = getimagesize($imgSrc);
switch (strtolower(substr($imgSrc, strrpos($imgSrc, '.')+1))) {
case "jpeg":
@@ -18,6 +21,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
default:
exit();
}
+ if(!$myImage) exit();
$ratio_orig = $width_orig/$height_orig;
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
@@ -47,9 +51,10 @@ $img = $_GET['img'];
$tmp = OC::$CONFIG_DATADIRECTORY . $img;
-header('Content-Type: image/png');
-$image = CroppedThumbnail($tmp, $box_size, $box_size);
-
-imagepng($image);
-imagedestroy($image);
-?>
+if(file_exists($tmp))
+{
+ header('Content-Type: image/png');
+ $image = CroppedThumbnail($tmp, $box_size, $box_size);
+ imagepng($image);
+ imagedestroy($image);
+} \ No newline at end of file
diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib_scanner.php
index 5490c4a55ad..1231de3f3c4 100644
--- a/apps/gallery/lib_scanner.php
+++ b/apps/gallery/lib_scanner.php
@@ -31,7 +31,7 @@ class OC_GALLERY_SCANNER {
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?');
$result = $stmt->execute(array(OC_User::getUser(), $current_album['name']));
if ($result->numRows() == 0 && count($current_album['images'])) {
- $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)');
+ $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)');
$stmt->execute(array(OC_User::getUser(), $current_album['name']));
}
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?');
@@ -42,7 +42,7 @@ class OC_GALLERY_SCANNER {
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ? AND `file_path` = ?');
$result = $stmt->execute(array($albumId, $img));
if ($result->numRows() == 0) {
- $stmt = OC_DB::prepare('REPLACE INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)');
+ $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)');
$stmt->execute(array($albumId, $img));
}
}
diff --git a/apps/media/css/player.css b/apps/media/css/player.css
index c4a098543d1..0f29748f351 100644
--- a/apps/media/css/player.css
+++ b/apps/media/css/player.css
@@ -1,7 +1,7 @@
#playercontrols{
display:inline;
margin-left:1em;
- width:7em;
+ width:4em;
height:1em;
position:fixed;
top:auto;