iavatar.php 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * This file is licensed under the Affero General Public License version 3 or
  4. * later.
  5. * See the COPYING-README file.
  6. */
  7. namespace OCP;
  8. /**
  9. * This class provides avatar functionality
  10. */
  11. interface IAvatar {
  12. /**
  13. * get the users avatar
  14. * @param int $size size in px of the avatar, avatars are square, defaults to 64
  15. * @return boolean|\OCP\IImage containing the avatar or false if there's no image
  16. */
  17. function get($size = 64);
  18. /**
  19. * Check if an avatar exists for the user
  20. *
  21. * @return bool
  22. */
  23. public function exists();
  24. /**
  25. * sets the users avatar
  26. * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar
  27. * @throws \Exception if the provided file is not a jpg or png image
  28. * @throws \Exception if the provided image is not valid
  29. * @throws \OC\NotSquareException if the image is not square
  30. * @return void
  31. */
  32. function set($data);
  33. /**
  34. * remove the users avatar
  35. * @return void
  36. */
  37. function remove();
  38. }