{"action":"created","issue":{"url":"https://api.github.com/repos/contao/core-bundle/issues/342","labels_url":"https://api.github.com/repos/contao/core-bundle/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/contao/core-bundle/issues/342/comments","events_url":"https://api.github.com/repos/contao/core-bundle/issues/342/events","html_url":"https://github.com/contao/core-bundle/pull/342","id":105458987,"number":342,"title":"[WIP] Image and Picture as services","user":{"login":"ausi","id":367169,"avatar_url":"https://avatars.githubusercontent.com/u/367169?v=3","gravatar_id":"","url":"https://api.github.com/users/ausi","html_url":"https://github.com/ausi","followers_url":"https://api.github.com/users/ausi/followers","following_url":"https://api.github.com/users/ausi/following{/other_user}","gists_url":"https://api.github.com/users/ausi/gists{/gist_id}","starred_url":"https://api.github.com/users/ausi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ausi/subscriptions","organizations_url":"https://api.github.com/users/ausi/orgs","repos_url":"https://api.github.com/users/ausi/repos","events_url":"https://api.github.com/users/ausi/events{/privacy}","received_events_url":"https://api.github.com/users/ausi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-09-08T20:05:35Z","updated_at":"2015-09-09T08:31:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/342","html_url":"https://github.com/contao/core-bundle/pull/342","diff_url":"https://github.com/contao/core-bundle/pull/342.diff","patch_url":"https://github.com/contao/core-bundle/pull/342.patch"},"body":"This is a very early draft of the image handling as a service. Here are my ideas:\r\n\r\nThe new classes `Contao\\CoreBundle\\Image\\Image` and `Contao\\CoreBundle\\Image\\Picture` work similar to the current classes, but with dependency injection and without the `create` and legacy methods. The new `Image` class uses `Imagine` to manipulate image data. The Image and Picture objects are created via a factory which is registered in the service container.\r\n\r\nThe old classes `Contao\\Image` and `Contao\\Picture` are wrappers  around the new classes and services to keep backwards compatibility.\r\n\r\nDoes that make sense?\r\n\r\n## Questions\r\n\r\n* [ ] How do we handle the the hooks `executeResize` and `getImage`? To be 100% backwards compatible we would have to pass an instance of the `Contao\\Image` class.\r\n* [ ] Should we still use the `Contao\\File` class?\r\n* [ ] `ImageFactory` and `PictureFactory` or `Factory` with `createImage` and `createPicture` methods?\r\n* [ ] Should we split the functionality of how the replaced images are saved/cached into a separate `contao.image.cache` service?\r\n* [ ] Is the `imagine_class` configuration node the right way to make the used Imagine class configurable?\r\n* [ ] We would need something like a `contao.adapter.model_repository` service to get access to the files and image size models."},"comment":{"url":"https://api.github.com/repos/contao/core-bundle/issues/comments/138824899","html_url":"https://github.com/contao/core-bundle/pull/342#issuecomment-138824899","issue_url":"https://api.github.com/repos/contao/core-bundle/issues/342","id":138824899,"user":{"login":"Toflar","id":481937,"avatar_url":"https://avatars.githubusercontent.com/u/481937?v=3","gravatar_id":"","url":"https://api.github.com/users/Toflar","html_url":"https://github.com/Toflar","followers_url":"https://api.github.com/users/Toflar/followers","following_url":"https://api.github.com/users/Toflar/following{/other_user}","gists_url":"https://api.github.com/users/Toflar/gists{/gist_id}","starred_url":"https://api.github.com/users/Toflar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toflar/subscriptions","organizations_url":"https://api.github.com/users/Toflar/orgs","repos_url":"https://api.github.com/users/Toflar/repos","events_url":"https://api.github.com/users/Toflar/events{/privacy}","received_events_url":"https://api.github.com/users/Toflar/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T08:31:24Z","updated_at":"2015-09-09T08:31:24Z","body":"> But I can inject doctrine and call ->getRepository('...') on it. IMO it would be great to have a single service to get any Contao model from.\r\n\r\n:+1: "}}