Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • I’ve had the same problem and figured it out now.

    The issue is that the JSON API plugin checks to see if a thumbnail file exists locally before it adds it to the JSON response. If it doesn’t exist it just omits it.

    The problem is locating in json-api/models/attachment.php in the query_images function at line 48.

    You’ll need to change this

     function query_images() {
        $sizes = array('thumbnail', 'medium', 'large', 'full');
        if (function_exists('get_intermediate_image_sizes')) {
          $sizes = array_merge(array('full'), get_intermediate_image_sizes());
        }
        $this->images = array();
        $home = get_bloginfo('url');
        foreach ($sizes as $size) {
          list($url, $width, $height) = wp_get_attachment_image_src($this->id, $size);
          $filename = ABSPATH . substr($url, strlen($home) + 1);
          if (file_exists($filename)) {
            list($measured_width, $measured_height) = getimagesize($filename);
            if ($measured_width == $width &&
                $measured_height == $height) {
              $this->images[$size] = (object) array(
                'url' => $url,
                'width' => $width,
                'height' => $height
              );
            }
          }
        }
      }

    To this

     function query_images() {
        $sizes = array('thumbnail', 'medium', 'large', 'full');
        if (function_exists('get_intermediate_image_sizes')) {
          $sizes = array_merge(array('full'), get_intermediate_image_sizes());
        }
        $this->images = array();
        $home = get_bloginfo('url');
        foreach ($sizes as $size) {
          list($url, $width, $height) = wp_get_attachment_image_src($this->id, $size);
          $this->images[$size] = (object) array(
                'url' => $url,
                'width' => $width,
                'height' => $height
              );
        }
      }

    And that will force the JSON api to return the S3 url and not bother checking if it exists locally

    I upgraded to Cloudflare 1.3.18 yesterday to see if it would make a difference. As of yet I haven’t come across any broken pages so maybe it’s been solved in this update. I’ll be sure to keep an eye out anyway and it’s good to know there is an alternative solution if need be

    It’s always nice to know your not the only one!

    Yes I am using cloudflare and I have the cloudflare plugin installed as well.

    I wonder is it the plugin causing the issues or the actual cloudflare service? The cloudflare service should operate without any problems even if the plugin isn’t installed.

    A quick search there and I’ve discovered there is a cloudflare extension for W3 total cache which I did not know about
    https://support.cloudflare.com/hc/en-us/articles/200169546-What-fields-do-I-need-to-enter-in-W3TC-W3-Total-Cache-settings-

    I’ve now set that up and see if that has any effect on it!

    I am having the exact same problem as well. Most of the pages are working fine, but every so often I stumble across a similar message. IT’s very strange and annoying, and I’ve yet to get a solution for it.

    If I log in to my site as an administrator and then manually purge the page from the cache it works fine, but obviously we shouldn’t have to be doing this.

    Any solution would be greatly appreciated also!

    Hmm I believe the reason is certainly because of the JSONP request. Because JSONP wraps the request in a function to get around the cross domain problems, the request url is slightly different everytime. So because it’s different I’m guessing that there is no transient to match it, hence a cached version is never shown.

    For example a standard browser $_SERVER['REQUEST_URI'] would look like
    ?json=1

    But when requesting from my app with JSONP it appears something like
    ?json=1&callback=jQuery19108552455483004451_1408920405423&_=1408920405424

    think I’ll have to do some string handling on the incoming request url to ignore everthing after the &callback and it should hopefully be ok!

    I’ll keep digging!

    Yes I think that’s what I’ll have to do alright, shouldn’t be too tricky, good to know I’m thinking in the right direction at least!

    However I’ve noticed another thing, I’m using the API for an app I’m building. When I have benchmarking enabled and I request the api from my browser I can see it’s serving a cached response.

    However when I request it from my app (via AJAX JSONP) I can see it’s not returning a cached response. No matter how many times I call the exact same request it returns a non cached version.

    I have a feeling it’s because it’s being requested via JSONP (to solve those pesky cross domain problems) but I’m not certain yet. Any ideas on that?

    Ah brilliant that’s great! I’ve been playing around with your copy and I can see you’ve a few additional things for custom fields and what not which I don’t have a need for.

    One thing I’m looking into is a way to store the cache until it has been purged.

    For example, our high volume news site needs to make sure the cache is cleared as soon as new content is published, but sometimes there could be several hours with no new news, so there’s no point in clearing the cache on an interval basis for this time.

    I know I could set a low interval for caching so the transients expiry quickly, but I’d prefer that they would only expire on a manual purge (or on a post publish event)

    I haven’t looked too hard just yet, but I’m sure there is a way to track these transients that are set and then purge them individually?

    Having a look at it I can see you used the transient api?

    Nice one, I’m currently looking into tweaking it a bit aswell, more so about adding in caching, can I ask how you went about doing it?

    Thread Starter robobobo100

    (@robobobo100)

    Worked it out in the end, it involved modifying the post.php file and adding my shortcode remove filters to the set_content_value() function

    Thread Starter robobobo100

    (@robobobo100)

    Yep, I’ve seen a few people post the same problem on the Woocommerce forums, so something has obviously changed in the latest Woocommerce update which is conflicting with it.

    Haven’t heard anything from the developer, so I had to go and write a custom login/register setup in the end. It’s only when you do that that you can appreciate the work the dev has put into this!

    Thread Starter robobobo100

    (@robobobo100)

    Ok I have identified Woocommerce as the conflicting plugin now, any ideas why this is and how to fix it?

    Thank god I found this post! It was what I needed! This was driving me nuts, I couldn’t make it work with the adsense code and now finally it does work by using the old code! I can’t see why it shouldn’t work with the new one though since you are able to enter a custom pub-id and ad-slot for each one

    Still at least it finally works

    Thread Starter robobobo100

    (@robobobo100)

    Thankfully it has,

    however not without a fight, i even reverted back to wordpress 3.0 and still it made no difference, disabled all plugins, nothing,

    then i started looking into the code on my dashboard to see where the different elements were coming from, and i then discovered that for some reason my /wp-includes/js folder was pretty much empty, hardly any of the folders had the wordpress files in them. So i re uploaded /wpincludes/js , but for some reason they refused to go on the server, several manual attempts at this and nothing. So then I went and manually made each folder and then uploaded each file individually to it! it took ages but now thankfully all works again

    Thread Starter robobobo100

    (@robobobo100)

    Ye i have, still no different

    What gets me is I have two blogs on the same host, and I upgraded both with the same wordpress files and ones fine and then the other has the issue above

Viewing 15 replies - 1 through 15 (of 18 total)