Pinterest Pin It Button For Images
Bad Image URLs - bug fix (1 post)

  1. FolioVision
    Posted 1 year ago #

    Hi there,

    there was a problem with the plugin when using relative image sources and having the image displayed in a post/page two or more times.

    there was <img src="/images/my-image.jpg" /> included in the post twice - the plugin replaced the relative source with absolute, but when the same image source was there 2 times, the output looked like this: <img src="http://mydomain.comhttp//mydomain.com/images/my-image.jpg" />

    function pibfi_Engine_normalize_image_paths needs to be updated in a following way:

    function pibfi_Engine_normalize_image_paths( $content ){
    	$matches = array();
    	preg_match_all('/<img(.*?)src=[\'"](.*?)[\'"](.*?)>/i', $content, $matches);
      <em>// addition 
      $matches[2] = array_unique($matches[2]);
      // end of addition</em>
      foreach($matches[2] as $match){
        if($match{0} == "/"){
    			$content = str_replace($match, get_bloginfo("siteurl") . $match, $content);
    	return $content;

    Hope this helps.

    [ Signature moderated. ]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Pinterest Pin It Button For Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic