{"action":"created","issue":{"url":"https://api.github.com/repos/getgrav/grav/issues/1107","repository_url":"https://api.github.com/repos/getgrav/grav","labels_url":"https://api.github.com/repos/getgrav/grav/issues/1107/labels{/name}","comments_url":"https://api.github.com/repos/getgrav/grav/issues/1107/comments","events_url":"https://api.github.com/repos/getgrav/grav/issues/1107/events","html_url":"https://github.com/getgrav/grav/pull/1107","id":183200141,"number":1107,"title":"ImageMedium#derivatives now works with image filters","user":{"login":"fredrikekelund","id":1101677,"avatar_url":"https://avatars.githubusercontent.com/u/1101677?v=3","gravatar_id":"","url":"https://api.github.com/users/fredrikekelund","html_url":"https://github.com/fredrikekelund","followers_url":"https://api.github.com/users/fredrikekelund/followers","following_url":"https://api.github.com/users/fredrikekelund/following{/other_user}","gists_url":"https://api.github.com/users/fredrikekelund/gists{/gist_id}","starred_url":"https://api.github.com/users/fredrikekelund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredrikekelund/subscriptions","organizations_url":"https://api.github.com/users/fredrikekelund/orgs","repos_url":"https://api.github.com/users/fredrikekelund/repos","events_url":"https://api.github.com/users/fredrikekelund/events{/privacy}","received_events_url":"https://api.github.com/users/fredrikekelund/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-10-15T09:43:39Z","updated_at":"2016-10-18T22:54:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/getgrav/grav/pulls/1107","html_url":"https://github.com/getgrav/grav/pull/1107","diff_url":"https://github.com/getgrav/grav/pull/1107.diff","patch_url":"https://github.com/getgrav/grav/pull/1107.patch"},"body":"This is a follow up to #1035, I had to close that PR since I forgot to point it to a feature branch.\r\n\r\n**Original description:**\r\n\r\nMy original motivation for writing this PR was the problem described in #1016, where using the derivatives method on an image in a Twig template wouldn't work well in combination with the other method of producing responsive images in Grav - appending a pixel density indicator to the image's filename (eg. \"@2x\").\r\n\r\nThe underlying problem here also meant that image filters would not work in combination with image derivatives. They would work with image alternatives, which is what was generated from appending \"@2x\" to the filename of the image, but it wouldn't work with derivatives.\r\n\r\nThis commit fixes both the first and the second problem by making it so that the ImageMedium#derivatives method doesn't add image variants to a separate array, but rather to the same array as it would have if the filename method was used.\r\n\r\nI've made some line comments to highlight a few things in the code as well!"},"comment":{"url":"https://api.github.com/repos/getgrav/grav/issues/comments/254662839","html_url":"https://github.com/getgrav/grav/pull/1107#issuecomment-254662839","issue_url":"https://api.github.com/repos/getgrav/grav/issues/1107","id":254662839,"user":{"login":"rhukster","id":1084697,"avatar_url":"https://avatars.githubusercontent.com/u/1084697?v=3","gravatar_id":"","url":"https://api.github.com/users/rhukster","html_url":"https://github.com/rhukster","followers_url":"https://api.github.com/users/rhukster/followers","following_url":"https://api.github.com/users/rhukster/following{/other_user}","gists_url":"https://api.github.com/users/rhukster/gists{/gist_id}","starred_url":"https://api.github.com/users/rhukster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhukster/subscriptions","organizations_url":"https://api.github.com/users/rhukster/orgs","repos_url":"https://api.github.com/users/rhukster/repos","events_url":"https://api.github.com/users/rhukster/events{/privacy}","received_events_url":"https://api.github.com/users/rhukster/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T22:54:27Z","updated_at":"2016-10-18T22:54:27Z","body":"Actually I did have it as `yosemite@2x.jpg`.. I changed to `yosmite.jpg` which is 2500px wide\r\n\r\n```\r\n![](yosemite.jpg?derivatives=500,2500,500&grayscale)\r\n```\r\n\r\nand get:\r\n\r\n```\r\n<img src=\"/grav-retina/images/7/6/6/6/e/7666e0abc53f5e8d95be9607246e1fcd63f473e8-yosemite.jpeg\" srcset=\"\r\n/grav-retina/images/2/f/f/2/d/2ff2d1f503b207eea8d967cf321cf22c7420fddb-yosemite2x.jpeg 500w, \r\n/grav-retina/images/e/5/6/f/e/e56fe33d6fd964aba5a272d37ea42b316eefc747-yosemite3x.jpeg 1000w, \r\n/grav-retina/images/b/8/6/d/a/b86dae05240eb0f9eacfb110866bfe7c26fbea28-yosemite4x.jpeg 1500w, \r\n/grav-retina/images/c/0/3/0/e/c030eea0a8d7b2a3996c7c66f851fc6ba241abaa-yosemite6x.jpeg 2000w, \r\n/grav-retina/images/7/6/6/6/e/7666e0abc53f5e8d95be9607246e1fcd63f473e8-yosemite.jpeg 2500w\" sizes=\"100vw\">\r\n```\r\n\r\nit's still not right though, first it probably makes more sense to just use the width in the derivatives rather than the `x` values, or even just a numeric value (1,2,3,4 etc) because the (1x, 2x, 3x, etc) are not correct.  2x is double, 3x is triple, and 4x is quadrupled.. however, derivatives are not doubled each time, they are just X pixels larger each time. \r\n\r\n1) the `src` attribute is using the 2500px wide `-yosemite.jpeg` file.\r\n2) the 500px wide image is labeled `-yosemite2x.jpeg` and it should be `1x` or `1` or `500w`, but not `2x`.\r\n3) the 2000px wide image is labeled `-yosemite6x.jpg, but really should be the 5th one, so `5` or `2000w`\r\n4) last one that is 2500px is the original so that's fine having nothing appended."}}
{"actor":{"display_login":"rhukster"}}