ipreview.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @author Georg Ehrke
  7. * @copyright 2013 Frank Karlitschek frank@owncloud.org
  8. * @copyright 2013 Georg Ehrke georg@owncloud.com
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  12. * License as published by the Free Software Foundation; either
  13. * version 3 of the License, or any later version.
  14. *
  15. * This library 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
  21. * License along with this library. 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. */
  35. interface IPreview
  36. {
  37. /**
  38. * Return a preview of a file
  39. * @param string $file The path to the file where you want a thumbnail from
  40. * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
  41. * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
  42. * @param boolean $scaleUp Scale smaller images up to the thumbnail size or not. Might look ugly
  43. * @return \OCP\Image
  44. */
  45. function createPreview($file, $maxX = 100, $maxY = 75, $scaleUp = false);
  46. /**
  47. * Returns true if the passed mime type is supported
  48. * @param string $mimeType
  49. * @return boolean
  50. */
  51. function isMimeSupported($mimeType = '*');
  52. /**
  53. * Check if a preview can be generated for a file
  54. *
  55. * @param \OCP\Files\FileInfo $file
  56. * @return bool
  57. */
  58. function isAvailable($file);
  59. }