{"action":"created","issue":{"url":"https://api.github.com/repos/jarednova/timber/issues/598","labels_url":"https://api.github.com/repos/jarednova/timber/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/jarednova/timber/issues/598/comments","events_url":"https://api.github.com/repos/jarednova/timber/issues/598/events","html_url":"https://github.com/jarednova/timber/issues/598","id":94115682,"number":598,"title":"TimberImage Resize returning incorrect URL","user":{"login":"leefroese","id":2066059,"avatar_url":"https://avatars.githubusercontent.com/u/2066059?v=3","gravatar_id":"","url":"https://api.github.com/users/leefroese","html_url":"https://github.com/leefroese","followers_url":"https://api.github.com/users/leefroese/followers","following_url":"https://api.github.com/users/leefroese/following{/other_user}","gists_url":"https://api.github.com/users/leefroese/gists{/gist_id}","starred_url":"https://api.github.com/users/leefroese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leefroese/subscriptions","organizations_url":"https://api.github.com/users/leefroese/orgs","repos_url":"https://api.github.com/users/leefroese/repos","events_url":"https://api.github.com/users/leefroese/events{/privacy}","received_events_url":"https://api.github.com/users/leefroese/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jarednova/timber/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-09T18:11:27Z","updated_at":"2015-10-26T03:00:55Z","closed_at":null,"body":"Since updating Timber to 0.21.5 I've been finding that the resize function on TimberImages doesn't return the absolute URL and is causing issues. I am using\r\n\r\n```\r\n<img src=\"{{TimberImage(item.slide).src|resize(670,410)}}\" />\r\n```\r\n\r\nThis outputs \"site-files/f37ca7b351defda658e8ed2dda9bdfa6-200x180-c-default.jpg\" instead of \"http://localhost:8888/ipw/site-files/f37ca7b351defda658e8ed2dda9bdfa6-200x180-c-default.jpg\""},"comment":{"url":"https://api.github.com/repos/jarednova/timber/issues/comments/151008727","html_url":"https://github.com/jarednova/timber/issues/598#issuecomment-151008727","issue_url":"https://api.github.com/repos/jarednova/timber/issues/598","id":151008727,"user":{"login":"zlove","id":108858,"avatar_url":"https://avatars.githubusercontent.com/u/108858?v=3","gravatar_id":"","url":"https://api.github.com/users/zlove","html_url":"https://github.com/zlove","followers_url":"https://api.github.com/users/zlove/followers","following_url":"https://api.github.com/users/zlove/following{/other_user}","gists_url":"https://api.github.com/users/zlove/gists{/gist_id}","starred_url":"https://api.github.com/users/zlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zlove/subscriptions","organizations_url":"https://api.github.com/users/zlove/orgs","repos_url":"https://api.github.com/users/zlove/repos","events_url":"https://api.github.com/users/zlove/events{/privacy}","received_events_url":"https://api.github.com/users/zlove/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T03:00:55Z","updated_at":"2015-10-26T03:00:55Z","body":"I believe this code in TimberImageHelper::_get_file_url() might be the culprit. It can result in a bad image url:\r\n\r\n    private static function _get_file_url($base, $subdir, $filename, $absolute) {\r\n        ...\r\n        if(!$absolute) {\r\n            $url = str_replace(home_url(), '', $url);\r\n        }\r\n        ...\r\n    }\r\n\r\nIf Wordpress is setup at a subdirectory like `http://www.example.com/wordpress-here/` a correct image url would be like `/wordpress-here/wp-content/2015/11/some-image.jpg`. The code above will strip out not just the host/protocol but also the `/wordpress-here/` leaving an incorrect url of `/wp-content/2015/11/some-image.jpg`.\r\n\r\nThis came up for me when:\r\n\r\n1. Wordpress is installed in a subdirectory\r\n2. I used the `resize()` filter in a Twig view with an image src that is a URL on a different domain.\r\n"}}