Hello,
in the aq_resizer.php in the GP Pro/blog module, at line 229 there is this part:
if ( defined( 'ICL_SITEPRESS_VERSION' ) ){
global $sitepress;
$url = $sitepress->convert_url( $url, $sitepress->get_default_language() );
}
Problem: On my site we use wpml with different domains, and if this function runs, it replaces all the attachment sources with the host from the default language. If this happens, I get the GP_Resize.process() error: Image must be local
error, because the resizer checks on line 103 if the upload url is in the image url:
if ( false === strpos( $url, $upload_url ) )
throw new GP_Exception('Image must be local: ' . $url);
In my case, the best would be if GP would not convert the url at all, because the images can just as well be served through the language domain. I changed the url convertion part like this:
if ( defined( 'ICL_SITEPRESS_VERSION' ) ){
global $sitepress;
$wpml_negotiation_type = apply_filters('wpml_setting',false, 'language_negotiation_type' ) ;
if ( $wpml_negotiation_type != 2) {
$url = $sitepress->convert_url( $url, $sitepress->get_default_language() );
}
}
That means I check if wpml is run on different domains for different languages (negotiation type is 2) and only convert only if not.
1) I am not sure why this conversion takes place to begin with. Maybe there is something special about my site, but I don’t understand this step.
2) If this is somehow necessary for other (normal?) setups, what would be the right approach to overwrite this function, so my fix does not get patched away in the future?
Thanks for your help