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.

iavatar.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <icewind@owncloud.com>
  7. * @author Robin McCorkell <robin@mccorkell.me.uk>
  8. * @author Roeland Jago Douma <rullzer@owncloud.com>
  9. *
  10. * @copyright Copyright (c) 2016, ownCloud, Inc.
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP;
  27. use OCP\Files\File;
  28. use OCP\Files\NotFoundException;
  29. /**
  30. * This class provides avatar functionality
  31. * @since 6.0.0
  32. */
  33. interface IAvatar {
  34. /**
  35. * get the users avatar
  36. * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image
  37. * @return boolean|\OCP\IImage containing the avatar or false if there's no image
  38. * @since 6.0.0 - size of -1 was added in 9.0.0
  39. */
  40. public function get($size = 64);
  41. /**
  42. * Check if an avatar exists for the user
  43. *
  44. * @return bool
  45. * @since 8.1.0
  46. */
  47. public function exists();
  48. /**
  49. * sets the users avatar
  50. * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar
  51. * @throws \Exception if the provided file is not a jpg or png image
  52. * @throws \Exception if the provided image is not valid
  53. * @throws \OC\NotSquareException if the image is not square
  54. * @return void
  55. * @since 6.0.0
  56. */
  57. public function set($data);
  58. /**
  59. * remove the users avatar
  60. * @return void
  61. * @since 6.0.0
  62. */
  63. public function remove();
  64. /**
  65. * Get the file of the avatar
  66. * @param int $size -1 can be used to not scale the image
  67. * @return File
  68. * @throws NotFoundException
  69. * @since 9.0.0
  70. */
  71. public function getFile($size);
  72. }