• Resolved Daniel Iser

    (@danieliser)


    Appears the image urls for each product (EDD) was coming through as simply “/wp-content/uploads/./..png”. I tracked it to this line:

    pixel-caffeine/includes/product-catalogs/class-feed-mapper.php:166

    The set_url_scheme only accepts null|string for the second argument. I just read it over to confirm and it only uses string comparison inside that function. So the correct usage would be either $image_link = set_url_scheme( $this->item->get_image_url(), null ); which returns whichever is in use at the time.

    Commenting that line out entirely did the trick as well. Not sure if you need that line for something else or not.

    Hope that helps someone.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Antonino Scarfì

    (@antoscarface)

    Hi,

    I didn’t understand very well the issue you have, on my end the feed write the right URL for the images.

    Anyway, good catch and maybe the better thing is to remove the second parameter, that is the same to pass null.

    Nevertheless, I want to use that function to force to use a scheme for the URL, because the URL must be written in a feed that should be used from an external service (in our case that is Facebook), so I want to make sure that all URLs have the correct scheme.

    So, I’d leave the function calling without the second parameter. Is it a good trick for your issue?

    Thank you for the catch and for reporting this! ??

    Thread Starter Daniel Iser

    (@danieliser)

    @antoscarface – Check this link: https://wppopupmaker.com/wp-content/uploads/product-catalogs/main-product-catalog.xml

    Currently the images don’t have the https://wppopupmaker.com/ in the the url so they are invalid links.

    With the above fix it does render. You can see the above is incorrect but that is related to the other issue I reported. If I manually generate that feed it has 17 products and proper links. When it generates every 1 hour or 6 hours etc it comes back with 16 and like that with broken images.

    Plugin Author Antonino Scarfì

    (@antoscarface)

    Do you use some specific plugin to obtain relative URL for the image? I can’t reproduce the issue. I want to find a safe way to force an absolute URL with scheme into the image link, but I need to understand where the relative URL cames from.

    Thread Starter Daniel Iser

    (@danieliser)

    @antoscarface – that was my first thought as we used to do that before we went 100% ssl 2 years ago. I searched through our custom code plugin and theme and my-plugins for such code but couldn’t find it.

    It also could be that the code we had before saved them as relative in the fb and it’s simply now regergitating them even when the code is removed.

    Will test again. That said on staging tests I disabled all plugins and changed to a default theme I believe and it still occurred.

    Will do further testing this week as I have a bit more time available.

    Plugin Author Antonino Scarfì

    (@antoscarface)

    Thank you, let me know.

    Meanwhile, try to replace the method get_image_url (where you found the set_url_scheme call), with this one:

    	public function get_image_url() {
    		$image_link = $this->item->get_image_url();
    		$image_link = set_url_scheme( $image_link );
    
    		// Force absolute
    		if ( preg_match( '/^\/?wp-content\/(.*)$/', $image_link, $match ) ) {
    			$image_link = content_url( $match[1] );
    		} else if ( preg_match( '/^\/([^\/].*)/', $image_link, $match ) ) {
    			$image_link = home_url( $match[1] );
    		}
    
    		$value = apply_filters( 'aepc_feed_item_image_link', $image_link, $this );
    
    		if ( empty( $value ) ) {
    			throw FeedException::mandatoryField( 'image_link', $this->item );
    		}
    
    		return $value;
    	}

    I added a snippet to force the absolute URL, try that and let me know.
    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Image paths erroring in facebook dash.’ is closed to new replies.