• IceDarkness

    (@icedarkness)


    I noticed on my AMP homepage that all the featured images were broken. Found out the WebP-Express function in features.php is pointing to the wrong directory. It should be http$1/wp-content/webp-express/webp-images/doc-root/wordpress/wp-content

    Wordpress is missing from the directory path.

    function ampforwp_webp_express_compatibility($content){
    	if(function_exists('webp_express_process_post')){
    		preg_match_all('/src="(.*?)"/', $content,$src);
    		if(isset($src[1][0])){
    			$img_url = esc_url($src[1][0]);
    			if(!preg_match('/\.webp/', $img_url)){
    				$config = \WebPExpress\Config::loadConfigAndFix();
    				if($config['destination-folder'] == 'mingled'){
    					$img_url_webp = $img_url;
    				}else{
    					$img_url_webp = preg_replace('/http(.*?)\/wp-content(.*?)/', 'http$1/wp-content/webp-express/webp-images$2', $img_url);
    					if($config['destination-structure'] == 'doc-root'){
    						$img_url_webp = preg_replace('/http(.*?)\/wp-content(.*?)/', 'http$1/wp-content/webp-express/webp-images/doc-root/wp-content$2', $img_url);
    					}
    				}
    				if(!preg_match('/\.webp/', $img_url)){	
    					$img_url_webp = esc_url($img_url_webp).".webp";
    			 		$content = str_replace($img_url, $img_url_webp, $content); 
    				}
    			}
    	 	}
    	}	
    	return $content;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Sorry for the inconvenience. Can you please share the URL of the issue? So that we will inspect the issue and get back to you with the solution.

    Thread Starter IceDarkness

    (@icedarkness)

    It’s https://www.avpgalaxy.net/amp/

    I’ve already made the change in the file.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Can you please let us know what changes you’ve done it means? Do let us know, So that we will analyze the scenario and get back to you.

    Thread Starter IceDarkness

    (@icedarkness)

    Well like I said I changed the path in features.php to add wordpress into the directory path.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    If possible, please reach out via the site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WebP-Express Issue’ is closed to new replies.