{"action":"created","issue":{"url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/129","labels_url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/129/comments","events_url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/129/events","html_url":"https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/pull/129","id":82161820,"number":129,"title":"Added check to make sure there's more than one image size.","user":{"login":"jhned","id":2520143,"avatar_url":"https://avatars.githubusercontent.com/u/2520143?v=3","gravatar_id":"","url":"https://api.github.com/users/jhned","html_url":"https://github.com/jhned","followers_url":"https://api.github.com/users/jhned/followers","following_url":"https://api.github.com/users/jhned/following{/other_user}","gists_url":"https://api.github.com/users/jhned/gists{/gist_id}","starred_url":"https://api.github.com/users/jhned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhned/subscriptions","organizations_url":"https://api.github.com/users/jhned/orgs","repos_url":"https://api.github.com/users/jhned/repos","events_url":"https://api.github.com/users/jhned/events{/privacy}","received_events_url":"https://api.github.com/users/jhned/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-28T23:03:30Z","updated_at":"2015-05-29T03:10:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/pulls/129","html_url":"https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/pull/129","diff_url":"https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/pull/129.diff","patch_url":"https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/pull/129.patch"},"body":"Fix for issue #121: So I checked for more than one image size by checking the sizes array of the WordPress image metadata array. If it's empty, then `tevkori_extend_image_tag` and `tevkori_filter_attachment_image_attributes` return `$html` and `$attr`, respectively.\r\n\r\nI tested this on a fresh VVV install with a 100x100 image and a 500x500 image and got the expected results.\r\n\r\nFor better efficiency, we could pass through the `$img_meta` array to `tevkori_get_srcset_array`, which both of those functions already use. It would be a small duplication of code, but not necessarily a duplication of effort, since both filters will never be running at the same time."},"comment":{"url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/comments/106669466","html_url":"https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/pull/129#issuecomment-106669466","issue_url":"https://api.github.com/repos/ResponsiveImagesCG/wp-tevko-responsive-images/issues/129","id":106669466,"user":{"login":"joemcgill","id":801097,"avatar_url":"https://avatars.githubusercontent.com/u/801097?v=3","gravatar_id":"","url":"https://api.github.com/users/joemcgill","html_url":"https://github.com/joemcgill","followers_url":"https://api.github.com/users/joemcgill/followers","following_url":"https://api.github.com/users/joemcgill/following{/other_user}","gists_url":"https://api.github.com/users/joemcgill/gists{/gist_id}","starred_url":"https://api.github.com/users/joemcgill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joemcgill/subscriptions","organizations_url":"https://api.github.com/users/joemcgill/orgs","repos_url":"https://api.github.com/users/joemcgill/repos","events_url":"https://api.github.com/users/joemcgill/events{/privacy}","received_events_url":"https://api.github.com/users/joemcgill/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T03:10:40Z","updated_at":"2015-05-29T03:10:40Z","body":"Hi @jhned, thanks for working through this. I think you're on the right track, but I'd suggest a little different approach. \r\n\r\nRather than looking for all sizes returned in the attachment metadata, we can place check for the size of the srcset array in the `tevkori_get_srcset_array()` function, and return false if the array length is less than 2. This has two benefits: a) You don't have to make additional calls to `wp_get_attachement_metadata()` and b) You avoid a situation where there are several sizes available but only one would be returned as a source candidate because of divergent aspect ratios.\r\n\r\nWe may also need to update the filters to only run if the `srcset` is not false."}}