summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-06-25 15:05:54 +0200
committerGitHub <noreply@github.com>2019-06-25 15:05:54 +0200
commitd4a44d9b784eef554a0e5450d07bd5d5d2d61193 (patch)
tree65c3940185836f6635558b62b16e5ee65b94a1a2 /lib/public
parent335af0c46c0034ea9052a90fa2b43a0b9bc985e7 (diff)
parent615061437422499025e038483504d4ef2004c8e1 (diff)
downloadnextcloud-server-d4a44d9b784eef554a0e5450d07bd5d5d2d61193.tar.gz
nextcloud-server-d4a44d9b784eef554a0e5450d07bd5d5d2d61193.zip
Merge pull request #15870 from nextcloud/preview-provider-v2
Add new Provider interface for preview providers
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Preview/IProvider.php1
-rw-r--r--lib/public/Preview/IProviderV2.php57
2 files changed, 58 insertions, 0 deletions
diff --git a/lib/public/Preview/IProvider.php b/lib/public/Preview/IProvider.php
index ca545d8eb76..5d62b3ce6d0 100644
--- a/lib/public/Preview/IProvider.php
+++ b/lib/public/Preview/IProvider.php
@@ -27,6 +27,7 @@ namespace OCP\Preview;
*
* @package OCP\Preview
* @since 8.1.0
+ * @deprecated 17.0.0 use IProviderV2 instead
*/
interface IProvider {
/**
diff --git a/lib/public/Preview/IProviderV2.php b/lib/public/Preview/IProviderV2.php
new file mode 100644
index 00000000000..97fca21eaf5
--- /dev/null
+++ b/lib/public/Preview/IProviderV2.php
@@ -0,0 +1,57 @@
+<?php declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Preview;
+
+use OCP\Files\File;
+use OCP\Files\FileInfo;
+use OCP\IImage;
+
+/**
+ * @since 17.0.0
+ */
+interface IProviderV2 {
+ /**
+ * @return string Regex with the mimetypes that are supported by this provider
+ * @since 17.0.0
+ */
+ public function getMimeType(): string;
+
+ /**
+ * Check if a preview can be generated for $path
+ *
+ * @param FileInfo $file
+ * @return bool
+ * @since 17.0.0
+ */
+ public function isAvailable(FileInfo $file): bool;
+
+ /**
+ * get thumbnail for file at path $path
+ *
+ * @param File $file
+ * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
+ * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
+ * @return null|\OCP\IImage null if no preview was generated
+ * @since 17.0.0
+ */
+ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage;
+}