WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP Smush.it] error - must be within the content directory (8 posts)

  1. diver66
    Member
    Posted 4 years ago #

    Hi,

    I have moved my media and plugins folder to subdomains on my server.
    Media -> subdomain uploads.my_domain.com and the plugins to plugins.my_domain.com,
    everything works nice and smooth except wp smushit, i keep getting an error on all images in the media folder once I try to smush them :

    /srv/www/vhosts/my_domain.org/subdomains/uploads/httpdocs/uploads/2010/05/aida20101.jpg must be within the content directory (/srv/www/vhosts/my_domain.org/httpdocs/wp-content)

    is there a workaround ? where can I change the path to my media in the wp-smushit.php

    I did this in my wp-config.php

    define( 'WP_SMUSHIT_PLUGIN_DIR','/srv/www/vhosts/my_domain.org/subdomains/plugins/httpdocs/wp-smushit' );

    but it does not change a thing, can I set the media path by hand ?

    many regards

    Joe

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

  2. Karine
    Member
    Posted 4 years ago #

    Same here, and the beta the author posted in an older post didn't work either...

    Hope it's fixed soon !

  3. mohanbn
    Member
    Posted 4 years ago #

    Me too looking for a solution for this... anyone listening?

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

  5. Ingenius Dastard
    Member
    Posted 4 years ago #

    Thank you ka-ri-ne, your solution worked.

    Here's the code snippet for wp-smushit.php, from lines 127 to 135:

    // check that the file is within the WP_CONTENT_DIR
    	$upload_dir = wp_upload_dir();
    	$wp_upload_dir = $upload_dir['basedir'];
    	$wp_upload_url = $upload_dir['baseurl'];
    	if ( 0 !== stripos(realpath($file_path), realpath($wp_upload_dir)) ) {
    		$msg = sprintf(__("<span class='code'>%s</span> must be within the content directory (<span class='code'>%s</span>)", WP_SMUSHIT_DOMAIN), htmlentities($file_path), $wp_upload_dir);
    
    		return array($file, $msg);
    	}
    
    	// determine the public URL
    	$file_url = str_replace( $wp_upload_dir, $wp_upload_url, $file );
  6. diver66
    Member
    Posted 3 years ago #

    Hi guys,

    there is a little discussion going on about the integration of lazyest gallery into wp smush.it

    http://wordpress.org/support/topic/lazyest-gallery-wp-smushit

    any input on this

    regards

    Joe

  7. Klark0
    Member
    Posted 3 years ago #

    ka-ri-ne,

    Thanks.

  8. Alex Dunae
    Member
    Posted 3 years ago #

    Thanks ka-ri-ne -- your fix will be in the update released today.

    Much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags