{"action":"created","issue":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/9235","labels_url":"https://api.github.com/repos/Elgg/Elgg/issues/9235/labels{/name}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/9235/comments","events_url":"https://api.github.com/repos/Elgg/Elgg/issues/9235/events","html_url":"https://github.com/Elgg/Elgg/issues/9235","id":122271710,"number":9235,"title":"Unifying icon display","user":{"login":"hypeJunction","id":1202761,"avatar_url":"https://avatars.githubusercontent.com/u/1202761?v=3","gravatar_id":"","url":"https://api.github.com/users/hypeJunction","html_url":"https://github.com/hypeJunction","followers_url":"https://api.github.com/users/hypeJunction/followers","following_url":"https://api.github.com/users/hypeJunction/following{/other_user}","gists_url":"https://api.github.com/users/hypeJunction/gists{/gist_id}","starred_url":"https://api.github.com/users/hypeJunction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypeJunction/subscriptions","organizations_url":"https://api.github.com/users/hypeJunction/orgs","repos_url":"https://api.github.com/users/hypeJunction/repos","events_url":"https://api.github.com/users/hypeJunction/events{/privacy}","received_events_url":"https://api.github.com/users/hypeJunction/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Elgg/Elgg/labels/dev%20usability","name":"dev usability","color":"444444"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-15T13:24:24Z","updated_at":"2015-12-16T16:45:15Z","closed_at":null,"body":"I am going to start a new issue since #8202 got closed when 1.x branch was deleted.\r\n\r\nMy latest thoughts on icons: get rid of icons and the concept as such! Images have thumbnails. Other entities may have some sort of icon implementation (e.g. file type icons in file plugin).\r\n\r\n* Introduce `ElggImage` class that extends `ElggFile`\r\n* Do cropping on `ElggImage::save()` based on global size config, thumbnails owned by `ElggImage` (to avoid having to move everything if image owner changes). No more spaghetti for cropping in actions.\r\n*  Add `ElggAvatar` that extends `ElggImage` with subtype `avatar`.\r\n* Add API to set/remove entity avatar.\r\n* Add generic pages for editing/cropping avatar entities.\r\n\r\n```php\r\nfunction elgg_get_avatar($entity) {\r\n    // ege* for 'object','avatar' with 'owner_guid' => $entity->guid\r\n}\r\n\r\nfunction elgg_set_avatar_from_upload($input, $entity) {\r\n    $avatar = elgg_get_avatar($entity);\r\n    if (!$avatar) {\r\n       $avatar = new ElggAvatar();\r\n       $avatar->owner_guid = $entity->guid;\r\n       // filename should be set magically in the constructor\r\n    }\r\n    \r\n    $avatar->open('write');\r\n    $avatar->write(file_get_contents($_FILES[$input]['tmp_name']));\r\n    $avatar->close();\r\n\r\n    $avatar->save(); // this will generate all the thumbs\r\n\r\n    return $avatar;\r\n}\r\n```\r\n\r\nWe may want to add `'preload_avatars'` option to ege* to reduce queries."},"comment":{"url":"https://api.github.com/repos/Elgg/Elgg/issues/comments/165170991","html_url":"https://github.com/Elgg/Elgg/issues/9235#issuecomment-165170991","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/9235","id":165170991,"user":{"login":"hypeJunction","id":1202761,"avatar_url":"https://avatars.githubusercontent.com/u/1202761?v=3","gravatar_id":"","url":"https://api.github.com/users/hypeJunction","html_url":"https://github.com/hypeJunction","followers_url":"https://api.github.com/users/hypeJunction/followers","following_url":"https://api.github.com/users/hypeJunction/following{/other_user}","gists_url":"https://api.github.com/users/hypeJunction/gists{/gist_id}","starred_url":"https://api.github.com/users/hypeJunction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypeJunction/subscriptions","organizations_url":"https://api.github.com/users/hypeJunction/orgs","repos_url":"https://api.github.com/users/hypeJunction/repos","events_url":"https://api.github.com/users/hypeJunction/events{/privacy}","received_events_url":"https://api.github.com/users/hypeJunction/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T16:45:14Z","updated_at":"2015-12-16T16:45:14Z","body":"https://github.com/hypeJunction/Elgg-images\r\nhttps://github.com/hypeJunction/Elgg-avatars\r\nhttps://github.com/hypeJunction/Elgg-avatars_user\r\nhttps://github.com/hypeJunction/Elgg-ui_icons\r\n"}}