IProviderV2.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Preview;
  8. use OCP\Files\File;
  9. use OCP\Files\FileInfo;
  10. use OCP\IImage;
  11. /**
  12. * @since 17.0.0
  13. */
  14. interface IProviderV2 {
  15. /**
  16. * @return string Regex with the mimetypes that are supported by this provider
  17. * @since 17.0.0
  18. */
  19. public function getMimeType(): string;
  20. /**
  21. * Check if a preview can be generated for $path
  22. *
  23. * @param FileInfo $file
  24. * @return bool
  25. * @since 17.0.0
  26. */
  27. public function isAvailable(FileInfo $file): bool;
  28. /**
  29. * get thumbnail for file at path $path
  30. *
  31. * @param File $file
  32. * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
  33. * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
  34. * @return null|\OCP\IImage null if no preview was generated
  35. * @since 17.0.0
  36. */
  37. public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage;
  38. }