IProviderV2.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php declare(strict_types=1);
  2. /**
  3. * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. namespace OCP\Preview;
  22. use OCP\Files\File;
  23. use OCP\Files\FileInfo;
  24. use OCP\IImage;
  25. /**
  26. * @since 17.0.0
  27. */
  28. interface IProviderV2 {
  29. /**
  30. * @return string Regex with the mimetypes that are supported by this provider
  31. * @since 17.0.0
  32. */
  33. public function getMimeType(): string;
  34. /**
  35. * Check if a preview can be generated for $path
  36. *
  37. * @param FileInfo $file
  38. * @return bool
  39. * @since 17.0.0
  40. */
  41. public function isAvailable(FileInfo $file): bool;
  42. /**
  43. * get thumbnail for file at path $path
  44. *
  45. * @param File $file
  46. * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
  47. * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
  48. * @return null|\OCP\IImage null if no preview was generated
  49. * @since 17.0.0
  50. */
  51. public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage;
  52. }