WordPress.org

Ready to get started?Download WordPress

Forums

WP Smush.it
[resolved] Must be within the content directory (3 posts)

  1. mohanbn
    Member
    Posted 4 years ago #

    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/

  2. Karine
    Member
    Posted 4 years ago #

    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 :)

  3. mohanbn
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic