WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WP Smush.it] Must be within the content directory

[Resolved] [Plugin: WP Smush.it] Must be within the content directory

  • Smush-it was working fine until I moved the media files from the default wp-content directory to a subfolder which is in the same level as that of root directory where wordpress is installed.

    I did so to ensure that the static content is served from a cookieless subdomain. Now everytime i try to smush an image, i get the following error:

    ../img/* must be within the content directory (../blog/wp-content)

    From the code of the plugin – http://plugins.svn.wordpress.org/wp-smushit/trunk/wp-smushit.php, it is evident that there is a condition check. Can we get rid of this? Is there an alternate solution to make it work for subdomains?

    http://wordpress.org/extend/plugins/wp-smushit/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was hoping for an upgrade, but it doesn’t seem ready yet so I modified it a bit to make it work with uploads out of the wp-content directory…

    Look for line 127

    // check that the file is within the WP_CONTENT_DIR

    Add this right after it :

    $upload_dir = wp_upload_dir();
    $wp_upload_dir = $upload_dir['basedir'];
    $wp_upload_url = $upload_dir['baseurl'];

    Replace WP_CONTENT_DIR by $wp_upload_dir
    And WP_CONTENT_URL by $wp_upload_url

    in lines 128, 129, and 135.

    This works for me 🙂

    Awesome! That worked like a charm 🙂
    thank you so much
    Mohan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: WP Smush.it] Must be within the content directory’ is closed to new replies.