[Resolved] GP and WPML multi domain Gp.resize not working as expected

Home Forums Support [Resolved] GP and WPML multi domain Gp.resize not working as expected

Home Forums Support GP and WPML multi domain Gp.resize not working as expected

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #416874
    Enrico

    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

    #417186
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    aq_resizer has been completely replaced in GPP 1.5. You can try out the latest beta version here: https://generatepress.com/gp-premium-1-5-alphabeta/

    Let me know if it fixes the issue ๐Ÿ™‚

    #420336
    Enrico

    Hi,
    just installed the new update (1.51) and the issue of not showing the featured post images with wpml on different domains is gone. Worked right out of the box after the update.

    Thanks

    #420337
    Tom
    Lead Developer
    Lead Developer

    Great news – thanks for letting me know ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.