diff options
author | Brice Maron <brice@bmaron.net> | 2011-10-22 11:01:06 +0200 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2011-10-22 11:01:06 +0200 |
commit | 9d46c378b9cb7abe78958c087912e5533d1f2144 (patch) | |
tree | dc6df20164dddc82fc67edd48aa2145cfc849ea3 /apps | |
parent | 0d4240e1963cbf2c0335f518cd2e7e1dac6d6daa (diff) | |
download | nextcloud-server-9d46c378b9cb7abe78958c087912e5533d1f2144.tar.gz nextcloud-server-9d46c378b9cb7abe78958c087912e5533d1f2144.zip |
Fix unescessary use of non portable 'replace' sql and add loging when GD not installed
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gallery/ajax/thumbnail.php | 3 | ||||
-rw-r--r-- | apps/gallery/lib_scanner.php | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index f24782390f6..325adb46bda 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": 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)); } } |