{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/115620943","pull_request_review_id":37175485,"id":115620943,"diff_hunk":"@@ -388,6 +389,24 @@ public static function filter_the_galleries( $galleries ) {\n \t\treturn $galleries;\n \t}\n \n+\n+\t/**\n+\t * Runs the image widget through photon.\n+\t *\n+\t * @param array $instance Image widget instance data.\n+\t * @return array\n+\t */\n+\tfunction filter_the_image_widget( $instance ) {\n+\t\tif ( Jetpack::is_module_active( 'photon' ) && ! $instance['attachment_id'] && $instance['url'] ) {\n+\t\t\tjetpack_photon_url( $instance['url'], array(","path":"class.photon.php","position":21,"original_position":21,"commit_id":"7ce3d6b3bc99dc694f508397acd63dc9b7621ae0","original_commit_id":"7ce3d6b3bc99dc694f508397acd63dc9b7621ae0","user":{"login":"westonruter","id":134745,"avatar_url":"https://avatars1.githubusercontent.com/u/134745?v=3","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"body":"Cross-posting from https://github.com/xwp/wp-core-media-widgets/issues/43#issuecomment-300324231\r\n\r\nIn regards to adding a new filter:\r\n\r\n> I think the issue is that Photon works best when it has access to the underlying `attachment_id`, `width`, and `height` which is what `Jetpack_Photon::filter_the_content()` is able to parse out of the `img` tag's `class` attribute, correct? To me it seems that `Jetpack_Photon::filter_the_content()` should be broken up into a couple methods to support the situation where all of the props are pre-parsed for you, as they would be in this case here. The image widget `$instance` has the size-specific image `url`, the `attachment_id`, the `width`, the `height`, and the selected image `size`. All of these pieces should be able to be used by Photon to create the best image URL without any need to re-parse HTML.","created_at":"2017-05-09T22:52:00Z","updated_at":"2017-05-09T22:52:01Z","html_url":"https://github.com/Automattic/jetpack/pull/7103#discussion_r115620943","pull_request_url":"https://api.github.com/repos/Automattic/jetpack/pulls/7103","_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/115620943"},"html":{"href":"https://github.com/Automattic/jetpack/pull/7103#discussion_r115620943"},"pull_request":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/7103"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/7103","id":118456163,"html_url":"https://github.com/Automattic/jetpack/pull/7103","diff_url":"https://github.com/Automattic/jetpack/pull/7103.diff","patch_url":"https://github.com/Automattic/jetpack/pull/7103.patch","issue_url":"https://api.github.com/repos/Automattic/jetpack/issues/7103","number":7103,"state":"open","locked":false,"title":"Widgets: Migrate Image Widget instances to proposed core widget","user":{"login":"ryelle","id":541093,"avatar_url":"https://avatars2.githubusercontent.com/u/541093?v=3","gravatar_id":"","url":"https://api.github.com/users/ryelle","html_url":"https://github.com/ryelle","followers_url":"https://api.github.com/users/ryelle/followers","following_url":"https://api.github.com/users/ryelle/following{/other_user}","gists_url":"https://api.github.com/users/ryelle/gists{/gist_id}","starred_url":"https://api.github.com/users/ryelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryelle/subscriptions","organizations_url":"https://api.github.com/users/ryelle/orgs","repos_url":"https://api.github.com/users/ryelle/repos","events_url":"https://api.github.com/users/ryelle/events{/privacy}","received_events_url":"https://api.github.com/users/ryelle/received_events","type":"User","site_admin":false},"body":"There's a proposal for a new core image widget in the works, which the core customizer folks want to see merged in WP 4.8. See [the the merge proposal](https://make.wordpress.org/core/2017/04/12/image-widget-merge-proposal/) & https://github.com/xwp/wp-core-media-widgets/issues/43 for more info.\r\n\r\nThe proposed core widget is a much nicer experience for adding an image, so we should migrate our users' widgets to the new widget (if available), and not register the Jetpack image widget. This PR adds a function that will run once in wp-admin to switch over any Jetpack image widgets to the core image widget.\r\n\r\nAdditionally this PR adds support for Photon in the widget ⚡️ \r\n\r\ncc @obenland (since the majority of the code came from your comment https://github.com/xwp/wp-core-media-widgets/issues/43#issuecomment-292252925 )\r\n\r\nTo test:\r\n\r\n- Add some (Jetpack) image widgets to your sidebars\r\n- Check out the front end of your site\r\n- Install & activate the [core widgets feature plugin](https://github.com/xwp/wp-core-media-widgets)\r\n- Go back to your widgets\r\n- The images you added should now be using the core widget (the title will be `Image` instead of `Image (Jetpack)`)\r\n- Make sure the front end of your site looks the same\r\n\r\n_Note:_ Merging this PR can probably wait until the core widget is merged, but that should be \"soon\" according to @melchoyce, so I'm dropping this here just to make sure it gets looked at early 🙂 ","created_at":"2017-05-01T22:50:07Z","updated_at":"2017-05-09T22:52:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94671cde73741fb4232d245c5468e1962e70a1a2","assignee":{"login":"ryelle","id":541093,"avatar_url":"https://avatars2.githubusercontent.com/u/541093?v=3","gravatar_id":"","url":"https://api.github.com/users/ryelle","html_url":"https://github.com/ryelle","followers_url":"https://api.github.com/users/ryelle/followers","following_url":"https://api.github.com/users/ryelle/following{/other_user}","gists_url":"https://api.github.com/users/ryelle/gists{/gist_id}","starred_url":"https://api.github.com/users/ryelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryelle/subscriptions","organizations_url":"https://api.github.com/users/ryelle/orgs","repos_url":"https://api.github.com/users/ryelle/repos","events_url":"https://api.github.com/users/ryelle/events{/privacy}","received_events_url":"https://api.github.com/users/ryelle/received_events","type":"User","site_admin":false},"assignees":[{"login":"ryelle","id":541093,"avatar_url":"https://avatars2.githubusercontent.com/u/541093?v=3","gravatar_id":"","url":"https://api.github.com/users/ryelle","html_url":"https://github.com/ryelle","followers_url":"https://api.github.com/users/ryelle/followers","following_url":"https://api.github.com/users/ryelle/following{/other_user}","gists_url":"https://api.github.com/users/ryelle/gists{/gist_id}","starred_url":"https://api.github.com/users/ryelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryelle/subscriptions","organizations_url":"https://api.github.com/users/ryelle/orgs","repos_url":"https://api.github.com/users/ryelle/repos","events_url":"https://api.github.com/users/ryelle/events{/privacy}","received_events_url":"https://api.github.com/users/ryelle/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"dereksmart","id":7129409,"avatar_url":"https://avatars2.githubusercontent.com/u/7129409?v=3","gravatar_id":"","url":"https://api.github.com/users/dereksmart","html_url":"https://github.com/dereksmart","followers_url":"https://api.github.com/users/dereksmart/followers","following_url":"https://api.github.com/users/dereksmart/following{/other_user}","gists_url":"https://api.github.com/users/dereksmart/gists{/gist_id}","starred_url":"https://api.github.com/users/dereksmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dereksmart/subscriptions","organizations_url":"https://api.github.com/users/dereksmart/orgs","repos_url":"https://api.github.com/users/dereksmart/repos","events_url":"https://api.github.com/users/dereksmart/events{/privacy}","received_events_url":"https://api.github.com/users/dereksmart/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/jetpack/pulls/7103/commits","review_comments_url":"https://api.github.com/repos/Automattic/jetpack/pulls/7103/comments","review_comment_url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/jetpack/issues/7103/comments","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/7ce3d6b3bc99dc694f508397acd63dc9b7621ae0","head":{"label":"Automattic:add/core-image-widget-compat","ref":"add/core-image-widget-compat","sha":"7ce3d6b3bc99dc694f508397acd63dc9b7621ae0","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars2.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":15231212,"name":"jetpack","full_name":"Automattic/jetpack","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars2.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2017-05-09T08:21:29Z","pushed_at":"2017-05-09T22:05:46Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"https://jetpack.com/","size":192426,"stargazers_count":649,"watchers_count":649,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":401,"mirror_url":null,"open_issues_count":790,"forks":401,"open_issues":790,"watchers":649,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"5cb1620ea422c9a4ecdc256c95cd1636e8a97d07","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars2.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":15231212,"name":"jetpack","full_name":"Automattic/jetpack","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars2.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2017-05-09T08:21:29Z","pushed_at":"2017-05-09T22:05:46Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"https://jetpack.com/","size":192426,"stargazers_count":649,"watchers_count":649,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":401,"mirror_url":null,"open_issues_count":790,"forks":401,"open_issues":790,"watchers":649,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/7103"},"html":{"href":"https://github.com/Automattic/jetpack/pull/7103"},"issue":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/7103"},"comments":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/7103/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/7103/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/7103/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/jetpack/statuses/7ce3d6b3bc99dc694f508397acd63dc9b7621ae0"}}}}
{"actor":{"display_login":"westonruter"}}