iavatar.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. */
  29. interface IAvatar {
  30. /**
  31. * get the users avatar
  32. * @param int $size size in px of the avatar, avatars are square, defaults to 64
  33. * @return boolean|\OCP\IImage containing the avatar or false if there's no image
  34. */
  35. function get($size = 64);
  36. /**
  37. * Check if an avatar exists for the user
  38. *
  39. * @return bool
  40. */
  41. public function exists();
  42. /**
  43. * sets the users avatar
  44. * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar
  45. * @throws \Exception if the provided file is not a jpg or png image
  46. * @throws \Exception if the provided image is not valid
  47. * @throws \OC\NotSquareException if the image is not square
  48. * @return void
  49. */
  50. function set($data);
  51. /**
  52. * remove the users avatar
  53. * @return void
  54. */
  55. function remove();
  56. }