iavatar.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <rmccorkell@karoshi.org.uk>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP;
  26. /**
  27. * This class provides avatar functionality
  28. * @since 6.0.0
  29. */
  30. interface IAvatar {
  31. /**
  32. * get the users avatar
  33. * @param int $size size in px of the avatar, avatars are square, defaults to 64
  34. * @return boolean|\OCP\IImage containing the avatar or false if there's no image
  35. * @since 6.0.0
  36. */
  37. public function get($size = 64);
  38. /**
  39. * Check if an avatar exists for the user
  40. *
  41. * @return bool
  42. * @since 8.1.0
  43. */
  44. public function exists();
  45. /**
  46. * sets the users avatar
  47. * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar
  48. * @throws \Exception if the provided file is not a jpg or png image
  49. * @throws \Exception if the provided image is not valid
  50. * @throws \OC\NotSquareException if the image is not square
  51. * @return void
  52. * @since 6.0.0
  53. */
  54. public function set($data);
  55. /**
  56. * remove the users avatar
  57. * @return void
  58. * @since 6.0.0
  59. */
  60. public function remove();
  61. }