diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-03-11 20:00:50 +0100 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-03-11 20:00:50 +0100 |
commit | 618f92b3fb6cde750e3fafd114c3f2f1179e434d (patch) | |
tree | befdfbbc289f27d4614beba8daf614b6c68ed6a4 /apps/gallery | |
parent | d5959872e1e92dedb07289e5c8df8bb11adcad92 (diff) | |
download | nextcloud-server-618f92b3fb6cde750e3fafd114c3f2f1179e434d.tar.gz nextcloud-server-618f92b3fb6cde750e3fafd114c3f2f1179e434d.zip |
fix thumbnail generation
Diffstat (limited to 'apps/gallery')
-rw-r--r-- | apps/gallery/lib/photo.php | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 463df2b5f4b..5e6df8069b5 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -13,11 +13,11 @@ * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* +* * You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ @@ -46,39 +46,39 @@ class OC_Gallery_Photo { return $stmt->execute(array($owner, $album_name)); } - public static function removeByPath($path) { - $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ?'); - $stmt->execute(array($path)); - } + public static function removeByPath($path) { + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ?'); + $stmt->execute(array($path)); + } - public static function removeById($id) { - $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?'); - $stmt->execute(array($id)); - } + public static function removeById($id) { + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?'); + $stmt->execute(array($id)); + } - public static function removeByAlbumId($albumid) { - $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE album_id = ?'); - $stmt->execute(array($albumid)); - } + public static function removeByAlbumId($albumid) { + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE album_id = ?'); + $stmt->execute(array($albumid)); + } - public static function changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath) { - $stmt = OC_DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?"); - $stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath)); - } + public static function changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath) { + $stmt = OC_DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?"); + $stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath)); + } public static function getThumbnail($image_name) { $save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/'; $save_dir .= dirname($image_name). '/'; - $image_path = self::getGalleryRoot().$image_name; - $thumb_file = $save_dir . basename($image_name); + $image_path = $image_name; + $thumb_file = $save_dir . basename($image_name); if (file_exists($thumb_file)) { $image = new OC_Image($thumb_file); } else { - $imagePath = OC_Filesystem::getLocalFile($image_path); - if(!file_exists($imagePath)) { + $image_path = OC_Filesystem::getLocalFile($image_path); + if(!file_exists($image_path)) { return null; } - $image = new OC_Image($imagePath); + $image = new OC_Image($image_path); if ($image->valid()) { $image->centerCrop(); $image->resize(200); @@ -95,7 +95,7 @@ class OC_Gallery_Photo { return null; } - public static function getGalleryRoot() { - return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', ''); - } + public static function getGalleryRoot() { + return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', ''); + } } |