content directory
-
I’m using the WordPress Skeleton setup which uses a custom content directory using the
WP_CONTENT_DIRand theWP_CONTENT_URLconstants.This plugin does not pick these up. Even after modifying the ‘Watch paths for images’ in the configuration page (wp-admin/options-general.php?page=wprxr), the .htaccess still contains wp-config:
# Adaptive Images <IfModule mod_rewrite.c> RewriteEngine On # Watch directories: RewriteCond %{REQUEST_URI} /wp-content/uploads/ RewriteRule \.(?:jpe?g|gif|png)$ /content/plugins/adaptive-images/adaptive-images/ai-main.php [L] </IfModule> # END Adaptive Images
-
Hi, there,
Thanks for pointing that out! I will check it right away.
Also, the new version is coming right up, and I will try to put the fix in it as well!
Awesome, thanks! It might be difficult to handle as the constants I’m using aren’t just text:
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' ); if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off') { $protocol = 'http'; } else { $protocol = 'https'; } define( 'WP_CONTENT_URL', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/content' );It is kinda tricky but if you set the actual directory in the watched directories then the plugin should work regardless of the WP_CONTENT_DIR or WP_CONTENT_URL constant. So the bug is probably where the settings are saved! However, the new version, has completely rewritten the settings page to be more user friendly, without the need for PHP code and be -cross my fingers- bug-free…
Hello, there, did you get a chance to test the new version yet? 🙂
Hi, there! Any news? We have committed version 0.3.5 now which has many more debugging features. If you get a chance maybe you can check it out…
Hi @nevma,
Sorry for the delay. Thank you for trying to fix this! It is certainly closer, but it doesn’t look like it has quite worked though.
My
.htaccessafter re-saving the settings:# Watched directories RewriteCond %{REQUEST_URI} /wp/content/uploads [OR] RewriteCond %{REQUEST_URI} /wp/content/themes # Redirect images through the adaptive images script RewriteRule \.(?:jpe?g|gif|png)$ /content/plugins/adaptive-images/adaptive-images/ai-main.php [L]This is my directory structure:
httpdocs - content (custom wp-content directory) - wp (wordpress)It figures out that I have WordPress in a subdirectory called
wp, and figures out the I’ve renamedwp-contenttocontent. However it still thinks thatcontentis underwp.Here’s the debug info if that helps:
✔ PHP GD library is installed. ✔ Image cache directory has been created. /var/www/vhosts/ia.klever.co.uk/httpdocs/content/cache/adaptive-images => drwxr-xr-x ✔ Installation .htaccess file is setup OK. /var/www/vhosts/ia.klever.co.uk/httpdocs/.htaccess => -rw-r--r-- ❖ Adaptive images settings dump: array(9) { ["resolutions"]=> array(3) { [0]=> int(1024) [1]=> int(640) [2]=> int(480) } ["cache-directory"]=> string(21) "cache/adaptive-images" ["watched-directories"]=> array(2) { [0]=> string(15) "content/uploads" [1]=> string(14) "content/themes" } ["jpeg-quality"]=> int(65) ["sharpen-images"]=> bool(true) ["watch-cache"]=> bool(true) ["browser-cache"]=> float(180) ["version"]=> string(6) "0.3.52" ["sanitized"]=> bool(true) }And the system information:
System information PHP 5.5.9-1ubuntu4.9 MySQL 5.5.40-0ubuntu0.14.04.1 WordPress 4.2.2 Multisite No Debug Mode No Table Prefix wp_ Web Server Apache Site url http://ia.klever.co.uk/wp Home url http://ia.klever.co.uk Permalinks /%year%/%monthnum%/%postname%/ PHP Error Log Ext/mysqli Yes WP Locale en_US DB Charset utf8 PHP Time Limit 60 WP Memory Limit 40M PHP Memory Limit 256M WP Max Upload Size 8mb PHP Post Max Size 8M PHP Upload Max Size 128M PHP Max Input Vars 1000 PHP Display Errors 0 Active plugins Adaptive Images for WordPress v.0.3.52 by Nevma Bootstrap 3 Shortcodes v.3.3.6 by Filip Stefansson, Simon Yeldon, and Michael W. Delaney Child Page Navigation v.1.3.3 by ITS Alaska Pitta Migration v.0.3.3 by Ian Channing @ VSN International W3 Total Cache v.0.9.4.1 by Frederick Townes MU plugins Adaptive Images for WordPress v.0.3.52 by Nevma Bootstrap 3 Shortcodes v.3.3.6 by Filip Stefansson, Simon Yeldon, and Michael W. Delaney Child Page Navigation v.1.3.3 by ITS Alaska Pitta Migration v.0.3.3 by Ian Channing @ VSN International W3 Total Cache v.0.9.4.1 by Frederick TownesIn
adaptive-images-actions.phpline 123 you guess the base directory based on where wp-admin is:$request_base_dir = substr( $request_uri, 0, strpos( $request_uri, '/wp-admin', 1 ) );But my watched ‘content’ directory lies outside wp.
My hacky attempt at a work around using
../content/uploadsdoesn’t work as you strip out the..Hello there, thank you for being so thorough and even going through the code!
Yes, I see what the problem is now. I am going to try to find a workaround in the way this path is calculated and get back to you…
I strip the “..” from the path so that one may not ascend to other directories of the system, either maliciously or by mistake. 🙁
Sorry – yes I meant to say that I was assuming it was to avoid hacking attempts (like mine :))
I ‘m afraid this is a case I haven’t predicted up to now. I will create a new test installatin for this and get back to you as soon as possible.
So far I can confirm that your use case is not compatible with the plugin. We will try to fix it in the near future.
It seems that moving the /wp-content to a new place does not make much of a difference after all. It is more of a convenience. So this is a relief, because one could simply move it back into the WordPress installation folder.
But I am not asking this from you! 🙂
I will keep you posted on any updates.
The topic ‘content directory’ is closed to new replies.