set_cover.php 505 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Set album cover image
  4. */
  5. // Get input data
  6. $album_guid = get_input('album_guid');
  7. $image_guid = get_input('image_guid');
  8. $album = get_entity($album_guid);
  9. if (!elgg_instanceof($album, 'object', 'album')) {
  10. register_error(elgg_echo('album:invalid_album'));
  11. forward(REFERER);
  12. }
  13. if ($album->setCoverImageGuid($image_guid)) {
  14. system_message(elgg_echo('album:save_cover_image'));
  15. forward(REFERER);
  16. } else {
  17. register_error(elgg_echo('album:cannot_save_cover_image'));
  18. forward(REFERER);
  19. }