• Resolved phj123

    (@phj123)


    Is it normal woocomemrce behavior that the new image engine / new responsive image code saves the main language images without URL prefix?

    On my main language (english) the image urls appear without url prefix: //website.com/wp-cont…

    But on the other languages the image url looks like it should with https prefix: https://website.com/wp-cont…

    This started after the update, is this normal behavior or do you maybe know why this is happening?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    I’m not sure I understand what you mean exactly. Is this just how they are showing up in the HTML on the site?

    Relative URLs for images is the default with how WordPress outputs responsive images, yes. Is this causing a problem?

    Thread Starter phj123

    (@phj123)

    Hey Caleb,

    Thank you for the reply! Yes, how they show up in the HTML is what I mean.

    Is there a way to tell WordPress to output all responsive images URLs in HTML absolute so with https:// prefix.

    Now it sometimes does this but sometimes it doesn’t. I just noticed this after the update!

    SSL plugins and or mixt content plugins didn’t get the job done, do you have any idea how to accomplish this?

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    I’m not sure to be honest. Perhaps would be better to take this on from the side of the issue occurring though. What problems is this causing?

    Thread Starter phj123

    (@phj123)

    Users can send their wishlist over, now on the main language with relative URLs (some), email clients will not display the images anymore.

    So this is why I need to only use absolute image URLs.

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The wishlist system is sending a direct copy of your web page? Seems strange?

    I think the problem might lie within the wishlist plugin, as emails should be sent with absolute URL’s I’d imagine if some clients have trouble with relative.

    Thread Starter phj123

    (@phj123)

    I use gravity forms to send the wishlist shortcode within the message, anyway, this was working fine and it has definitely nothing to do with the wishlist plugin or the way I send the message.

    Before the update, when all my image URLs did appear absolute there wasn’t a display problem at all.

    • This reply was modified 6 years, 8 months ago by phj123.
    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Right, I understand it was working previously. But just if/because this started happening after relative URLs were added doesn’t mean the change was wrong / bugged.

    It’s in the emails that relative URLs should not be used, thus it’s up to how emails are being made and sent.

    As far as I can tell the product archives in WooCommerce are the full URL by default, just minus the protocol (http / https).

    Thread Starter phj123

    (@phj123)

    And is there a way that you know of to add https:// to WooCommerce responsive archive image URLs?

    • This reply was modified 6 years, 8 months ago by phj123.
    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Looks like this filter is what you need to hook into the right place to prevent relative urls: https://github.com/woocommerce/woocommerce/blob/28a4e88811abd53280cc05f20067ce26e54826e4/includes/abstracts/abstract-wc-product.php#L1812

    Prevent the call to wc_get_relative_url.

    Thread Starter phj123

    (@phj123)

    Thank you for your reply again it is much appreciated!

    Somehow I can’t figure out how to adapt the filter so it will put out absolute URLs.

    Do you have an idea how to accomplish this?

    Try this:

    /**
     * Remove relative URLs for WooCommerce product images
     */
    add_filter( 'woocommerce_product_get_image', function( $url, $product, $size, $attr, $placeholder, $image ) {
    	return $image;
    }, 10, 6 );
    Thread Starter phj123

    (@phj123)

    Wow REALLY NICE, Thank you so much!

    Haha as you aspect from my reaction, it is definitely working!

    ??

    Excellent! ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Images saved without url prefix’ is closed to new replies.