You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ipreview.php 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Thomas Müller <thomas.mueller@tmit.eu>
  7. *
  8. * @copyright Copyright (c) 2016, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Preview interface
  27. *
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP;
  32. /**
  33. * This class provides functions to render and show thumbnails and previews of files
  34. * @since 6.0.0
  35. */
  36. interface IPreview {
  37. /**
  38. * In order to improve lazy loading a closure can be registered which will be
  39. * called in case preview providers are actually requested
  40. *
  41. * $callable has to return an instance of \OCP\Preview\IProvider
  42. *
  43. * @param string $mimeTypeRegex Regex with the mime types that are supported by this provider
  44. * @param \Closure $callable
  45. * @return void
  46. * @since 8.1.0
  47. */
  48. public function registerProvider($mimeTypeRegex, \Closure $callable);
  49. /**
  50. * Get all providers
  51. * @return array
  52. * @since 8.1.0
  53. */
  54. public function getProviders();
  55. /**
  56. * Does the manager have any providers
  57. * @return bool
  58. * @since 8.1.0
  59. */
  60. public function hasProviders();
  61. /**
  62. * Return a preview of a file
  63. * @param string $file The path to the file where you want a thumbnail from
  64. * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
  65. * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
  66. * @param boolean $scaleUp Scale smaller images up to the thumbnail size or not. Might look ugly
  67. * @return \OCP\IImage
  68. * @since 6.0.0
  69. */
  70. public function createPreview($file, $maxX = 100, $maxY = 75, $scaleUp = false);
  71. /**
  72. * Returns true if the passed mime type is supported
  73. * @param string $mimeType
  74. * @return boolean
  75. * @since 6.0.0
  76. */
  77. public function isMimeSupported($mimeType = '*');
  78. /**
  79. * Check if a preview can be generated for a file
  80. *
  81. * @param \OCP\Files\FileInfo $file
  82. * @return bool
  83. * @since 8.0.0
  84. */
  85. public function isAvailable(\OCP\Files\FileInfo $file);
  86. }