diff options
author | Olivier Paroz <github@oparoz.com> | 2015-04-02 10:31:24 +0200 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-04-02 10:31:24 +0200 |
commit | 8ec6dfdbf8e68966b1110b8e7b16019518e20bdf (patch) | |
tree | bd3eef6befa5a3fd943c758cbe2d9c647ca7c9f1 /lib/private/preview | |
parent | 691c353eeda077be0fcca1e3839265815a650a90 (diff) | |
download | nextcloud-server-8ec6dfdbf8e68966b1110b8e7b16019518e20bdf.tar.gz nextcloud-server-8ec6dfdbf8e68966b1110b8e7b16019518e20bdf.zip |
Split image provider in one sub-class per media type
Diffstat (limited to 'lib/private/preview')
-rw-r--r-- | lib/private/preview/bmp.php | 31 | ||||
-rw-r--r-- | lib/private/preview/gif.php | 31 | ||||
-rw-r--r-- | lib/private/preview/image.php | 10 | ||||
-rw-r--r-- | lib/private/preview/jpeg.php | 31 | ||||
-rw-r--r-- | lib/private/preview/png.php | 31 | ||||
-rw-r--r-- | lib/private/preview/xbitmap.php | 31 |
6 files changed, 157 insertions, 8 deletions
diff --git a/lib/private/preview/bmp.php b/lib/private/preview/bmp.php new file mode 100644 index 00000000000..0547f053cc1 --- /dev/null +++ b/lib/private/preview/bmp.php @@ -0,0 +1,31 @@ +<?php +/** + * @author Olivier Paroz <owncloud@interfasys.ch> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Preview; + +class BMP extends Image { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/bmp/'; + } +} diff --git a/lib/private/preview/gif.php b/lib/private/preview/gif.php new file mode 100644 index 00000000000..e2b7c7e2ea2 --- /dev/null +++ b/lib/private/preview/gif.php @@ -0,0 +1,31 @@ +<?php +/** + * @author Olivier Paroz <owncloud@interfasys.ch> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Preview; + +class GIF extends Image { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/gif/'; + } +} diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php index 9770ca322e9..2c69d29f4cb 100644 --- a/lib/private/preview/image.php +++ b/lib/private/preview/image.php @@ -1,7 +1,7 @@ <?php /** * @author Georg Ehrke <georg@owncloud.com> - * @author Georg Ehrke <georg@ownCloud.com> + * @author Olivier Paroz <owncloud@interfasys.ch> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> @@ -25,13 +25,7 @@ */ namespace OC\Preview; -class Image extends Provider { - /** - * {@inheritDoc} - */ - public function getMimeType() { - return '/image\/(?!tiff$)(?!svg.*).*/'; - } +abstract class Image extends Provider { /** * {@inheritDoc} diff --git a/lib/private/preview/jpeg.php b/lib/private/preview/jpeg.php new file mode 100644 index 00000000000..69edd95835c --- /dev/null +++ b/lib/private/preview/jpeg.php @@ -0,0 +1,31 @@ +<?php +/** + * @author Olivier Paroz <owncloud@interfasys.ch> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Preview; + +class JPEG extends Image { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/jpeg/'; + } +} diff --git a/lib/private/preview/png.php b/lib/private/preview/png.php new file mode 100644 index 00000000000..f40c1dbcc88 --- /dev/null +++ b/lib/private/preview/png.php @@ -0,0 +1,31 @@ +<?php +/** + * @author Olivier Paroz <owncloud@interfasys.ch> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Preview; + +class PNG extends Image { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/png/'; + } +} diff --git a/lib/private/preview/xbitmap.php b/lib/private/preview/xbitmap.php new file mode 100644 index 00000000000..db7b85ff012 --- /dev/null +++ b/lib/private/preview/xbitmap.php @@ -0,0 +1,31 @@ +<?php +/** + * @author Olivier Paroz <owncloud@interfasys.ch> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program 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 + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Preview; + +class XBitmap extends Image { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/x-xbitmap/'; + } +} |