• ResolvedPlugin Author puravida1976

    (@puravida1976)


    Hello Dan,

    We have a few tickets in our support desk for a WP-Portfolio bug that was uncovered due to a recent change in our system (http://www.shrinktheweb.com/content/now-inside-pages-are-automatic-when-upgraded.html).

    In order for “Inside Pages” to work automatically, we must assume that &stwurl is the last parameter in the request. This has always been recommended “Best Practice” but now it is mandatory for all requests. Based on a comment in your code, it looks like you took this into account originally. However, somewhere along the way, you added an $args[‘filetype’] AFTER the &stwurl.

    The downside is that not following the guideline of &stwurl being last means that the request will fail with error “Invalid Characters in Domain Name.”

    Fortunately, the fix is simple:

    Open the file:
    /wp-content/wp-portfolio/lib/thumbnailer.inc.php

    FIND THESE LINES:

    // Add arguments not yet added
    $args[“Service”] = “ShrinkWebUrlThumbnail”;
    $args[“Action”] = “Thumbnail”;
    $args[“stwurl”] = $url; // now url is added to the parameters at the end

    // Check the error cache for the error rather than do a fresh request.
    // If there’s an error, return the cached error rather than wasting a request
    $cachedError = WPPortfolio_errors_checkForCachedError($args, $pendingThumbPath);
    if ($cachedError) {
    return $cachedError;
    }

    $actualThumbPath = trailingslashit($actualThumbPath);

    $type = strtolower(substr(strrchr($url, ‘.’), 0));

    $args[‘filetype’] = $type;

    REPLACE WITH:

    // Check the error cache for the error rather than do a fresh request.
    // If there’s an error, return the cached error rather than wasting a request
    $cachedError = WPPortfolio_errors_checkForCachedError($args, $pendingThumbPath);
    if ($cachedError) {
    return $cachedError;
    }

    $actualThumbPath = trailingslashit($actualThumbPath);

    $type = strtolower(substr(strrchr($url, ‘.’), 0));

    $args[‘filetype’] = $type;

    // Add arguments not yet added
    $args[“stwurl”] = $url; // now url is added to the parameters at the end

    ***** END FIX *****

    I also removed two deprecated $args just to keep the code/requests clean.

    http://wordpress.org/plugins/wp-portfolio/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author puravida1976

    (@puravida1976)

    FYI: I have modified our script to account for the WP-Portfolio bug (so your user’s pages look good again, for now), BUT this is only a temporary fix and will go away eventually.

    So you will still need to make the changes detailed before. I just took the pressure off a bit by supporting this “hiccup” so your users won’t have broken images until they upgrade. 😉

    Thanks Brandon

    Fixed applied, and will be in repository shortly.

    Dan

    Plugin Author puravida1976

    (@puravida1976)

    That was super quick! Thanks for staying on top of things. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug in thumbnailer.inc.php (with fix)’ is closed to new replies.