Forums

[resolved] [Plugin: WP-o-Matic] Image Caching Fix (2 posts)

  1. bjsmith3
    Member
    Posted 5 months ago #

    I had been banging my head as to why some of my images would cache fine while others would not. I found that the broken image URLs contained spaces and that two steps were needed to make sure the image cache handled them correctly.

    In wpomatic.php go to line 709 and use this code instead:

    foreach($urls as $url)
            {
              $url = str_replace(" ","%20",$url); // change spaces to %20 so the image cache doesn't fail
              $newurl = $this->cacheRemoteImage($url);
              if($newurl) {
              $url = str_replace("%20"," ",$url); // change %20 back to spaces now because $content has spaces
                $content = str_replace($url, $newurl, $content);
              }
            }

    Basically, this is a quick hack that will encode spaces to %20 first, which allows the cache to complete successfully. Then prior to updating our post with the cached image we convert the search string back to spaces (because $content needs spaces in it)

    Hope this helps resolve problems for a few of you. And I really hope they release the new version soon ... I've been refreshing the wpomatic twitter status about every 10 minutes for the last week.

  2. benjiballin
    Member
    Posted 4 months ago #

    this is not working for me

Reply

You must log in to post.

About this Topic

Tags