{"id":12976042,"date":"2020-06-12T10:08:28","date_gmt":"2020-06-12T10:08:28","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/does-not-show-image-by-url\/"},"modified":"2020-06-12T10:08:28","modified_gmt":"2020-06-12T10:08:28","slug":"does-not-show-image-by-url","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/does-not-show-image-by-url\/","title":{"rendered":"Does not show image by url"},"content":{"rendered":"<p>Hi in thumbnail.php around line 100 in fifu_replace() which is a filter for post_thumbnail_html we have:<\/p>\n<pre><code>\n    if ($url) {\n        if (fifu_is_on(&#039;fifu_class&#039;)) {\n            if (strpos($html, &#039;class=&#039;))\n                $html = preg_replace(&#039;\/class=[\\&#039;\\&quot;][^[\\&#039;\\&quot;]*[\\&#039;\\&quot;]\/&#039;, &#039;class=&quot;fifu-class&quot;&#039;, $html);\n            else\n                $html = str_replace(&#039;&lt;img&#039;, &#039;&lt;img class=&quot;fifu-class&quot;&#039;, $html);\n        }\n\n        return $css ? str_replace(&#039;\/&gt;&#039;, &#039; style=&quot;&#039; . $css . &#039;&quot;\/&gt;&#039;, $html) : $html;\n    }\n\n    return !$url ? $html : fifu_get_html($url, $alt, $width, $height);\n}<\/code><\/pre>\n<p>I added some logging.<br \/>\nIf there is a $url (it exists in my case) it returns prematurely in the line &#8216;return $css ?&#8230;.&#8217; without having the chance to add the image.<\/p>\n<p>This is done in the last line but it never gets there if $url exists.<\/p>\n<p>I think a proper patch is:<\/p>\n<pre><code>--- wp-content\/plugins\/featured-image-from-url\/includes\/thumbnail.php   (revision 21128)\n+++ wp-content\/plugins\/featured-image-from-url\/includes\/thumbnail.php   (working copy)\n@@ -112,7 +112,7 @@\n                 $html = str_replace(&#039;&lt;img&#039;, &#039;&lt;img class=&quot;fifu-class&quot;&#039;, $html);\n         }\n \n-        return $css ? str_replace(&#039;\/&gt;&#039;, &#039; style=&quot;&#039; . $css . &#039;&quot;\/&gt;&#039;, $html) : $html;\n+        $html = $css ? str_replace(&#039;\/&gt;&#039;, &#039; style=&quot;&#039; . $css . &#039;&quot;\/&gt;&#039;, $html) : $html;\n     }\n \n     return !$url ? $html : fifu_get_html($url, $alt, $width, $height);<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-12976042","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12976042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12976042\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12976042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}