Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPML error: Image must be local when enabling "directory for default language" #101

Open
PixelbarEupen opened this issue Jun 21, 2017 · 1 comment

Comments

@PixelbarEupen
Copy link

When I enable "directory for default language" in WPML, aq_resize fails to resize images because it can't find the image. The error log says:
Aq_Resize.process() error: Image must be local: URL

It is because WPML rewrites the image url to http://sitedomain/LANGAUGE_CODE/wp-content/uploads/image.jpg.

I added a small fix in the WPML-Fix in the aq_resize script:

/* WPML Fix */ if ( defined( 'ICL_SITEPRESS_VERSION' ) ){ global $sitepress; if( ICL_LANGUAGE_CODE !== $sitepress->get_default_language() ) { $url = $sitepress->convert_url( $url, $sitepress->get_default_language() ); } } /* WPML Fix */

This solution works for me.

@PixelbarEupen
Copy link
Author

Actually i got a better (not perfect) approach:

/* WPML Fix */ if ( defined( 'ICL_SITEPRESS_VERSION' ) ){ $wpml = maybe_unserialize( get_option('icl_sitepress_settings') ); if( ! $wpml['urls']['directory_for_default_language'] ) { global $sitepress; $url = $sitepress->convert_url( $url, $sitepress->get_default_language() ); } } /* WPML Fix */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant