aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-04-10 15:57:06 +0200
committerGitHub <noreply@github.com>2020-04-10 15:57:06 +0200
commiteba3726e1e1b7ce0a98df4552cfdecfe05e0d63a (patch)
tree7d50a939305460fbb34078c1da49f992552747e7 /lib/public
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
parent8f9bac26f874e105c017de2b1791b23c2a135b28 (diff)
downloadnextcloud-server-eba3726e1e1b7ce0a98df4552cfdecfe05e0d63a.tar.gz
nextcloud-server-eba3726e1e1b7ce0a98df4552cfdecfe05e0d63a.zip
Merge pull request #19495 from nextcloud/preview-generate-batch
optimize batch generation of previews
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/IImage.php39
-rw-r--r--lib/public/IPreview.php13
2 files changed, 52 insertions, 0 deletions
diff --git a/lib/public/IImage.php b/lib/public/IImage.php
index 67db6b097ef..6e6c28609d8 100644
--- a/lib/public/IImage.php
+++ b/lib/public/IImage.php
@@ -190,4 +190,43 @@ interface IImage {
* @since 8.1.0
*/
public function scaleDownToFit($maxWidth, $maxHeight);
+
+ /**
+ * create a copy of this image
+ *
+ * @return IImage
+ * @since 19.0.0
+ */
+ public function copy(): IImage;
+
+ /**
+ * create a new cropped copy of this image
+ *
+ * @param int $x Horizontal position
+ * @param int $y Vertical position
+ * @param int $w Width
+ * @param int $h Height
+ * @return IImage
+ * @since 19.0.0
+ */
+ public function cropCopy(int $x, int $y, int $w, int $h): IImage;
+
+ /**
+ * create a new resized copy of this image
+ *
+ * @param int $width
+ * @param int $height
+ * @return IImage
+ * @since 19.0.0
+ */
+ public function preciseResizeCopy(int $width, int $height): IImage;
+
+ /**
+ * create a new resized copy of this image
+ *
+ * @param integer $maxSize The maximum size of either the width or height.
+ * @return IImage
+ * @since 19.0.0
+ */
+ public function resizeCopy(int $maxSize): IImage;
}
diff --git a/lib/public/IPreview.php b/lib/public/IPreview.php
index b377d285acb..164cbbac2bf 100644
--- a/lib/public/IPreview.php
+++ b/lib/public/IPreview.php
@@ -115,4 +115,17 @@ interface IPreview {
* @since 8.0.0
*/
public function isAvailable(\OCP\Files\FileInfo $file);
+
+ /**
+ * Generates previews of a file
+ *
+ * @param File $file
+ * @param array $specifications
+ * @param string $mimeType
+ * @return ISimpleFile the last preview that was generated
+ * @throws NotFoundException
+ * @throws \InvalidArgumentException if the preview would be invalid (in case the original image is invalid)
+ * @since 19.0.0
+ */
+ public function generatePreviews(File $file, array $specifications, $mimeType = null);
}