The local url check on line 35 does not work when WPML is set to use a different directory for the languages (e.g. http://www.smartcode.ch/de for german).
The current check, using home_url() fails, since this function does return http://www.smartcode.ch/de if on the german page.
I suggest to replace home_url() with $upload_url (defined on line 32), which is wp_upload_dir() -> baseurl on line 35 to check if the image url ($url) is local.
The local url check on line 35 does not work when WPML is set to use a different directory for the languages (e.g. http://www.smartcode.ch/de for german).
The current check, using
home_url()
fails, since this function does returnhttp://www.smartcode.ch/de
if on the german page.I suggest to replace
home_url()
with$upload_url
(defined on line 32), which iswp_upload_dir() -> baseurl
on line 35 to check if the image url ($url
) is local.