-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help for people running wordpress #22
Comments
Hi. I'm trying to get it to work on my Wordpress site, but don't know exactly how. I've installed WP in a subfolder wcms. Right now i have all the stuff in the root: .htaccess, adaptive-images.php and ai-cache folder with permission 777. htaccess file looks like that-> RewriteBase /wcms/ Should i put the php file and cache folder in a subfolder where the WP is installed (wcms) or even in my theme folder? The .htaccess file must be in the root? If i put a-i.php and cache folder in wcms folder or theme folder, what files and what paths i have to change? I've tried different options but could not get it right. In some cases all my images where missing. That seems to be the question of these lines in htaccess: RewriteCond %{REQUEST_URI} !uploads. Am i right? At the moment i see all my images but checking the site on my phone still gets large file (900x650px). |
I don't know myself as I don't use WordPress. I do think that the RewriteBase statement may be causing problems for you though. The .htaccess file needs to be at the highest level you'll want to use AI with, which is normally root, but you may be ok with it in the /wcms/ folder instead, so give that a try if you like. I don't actually know what rewrite base does (I can guess, but wouldn't know how it might effect other things). It's almost definitely messing about with paths though, and that is likely why it's not working for you. |
I have the same setup as Kaimps: Wordpress installation in sub-folder, ai-cache folder, adaptive-images.php and htaccess also in subfolder. As soon as I add the htaccess statement I get an "Internal Server Error" (blank page with that message),
This is how my whole .htaccess file looks like: ` RewriteCond %{REQUEST_URI} !themes I also removed the Wordpress rewrite statement i.e. RewriteBase for testing, but the result is the same,
Any hints greatly appreciated, it would totally solve the whole dilemma around image for responsive websites (based on Wordpress)! |
Might best be solved as a plug-in in wp.org, this way it's handled once for the WP crowd. |
It likely would, only I don't use WordPress so can't make one. Anyone's welcome to do so if they have the skills! :) |
I just installed the script on a subfolder installation of wordpress. Here is what I did that worked.... The .htaccess and the adpative-images.php file are both in the subfolder, the Wordpress installation root. I created a new folder in wp-content/uploads for the stored images and added the path to the adaptive-images.php file: "wp-content/uploads/adaptcache". I then edited the .htaccess file to restrict access to my theme files, plugin files, wp-admim folder and wp-includes folder. RewriteCond %{REQUEST_URI} !wp-content/themes Hope this helps someone! |
Anyone have any suggestions for integrating this script into a multisite Wordpress environment? I'm going to tackle it but thought I would throw the idea out for suggestions first. |
I did create a WP plugin for this, but not using the adaptive images code (certainly not for any negative reason, just envisioned a different fit/implementation): http://wordpress.org/extend/plugins/hammy/ |
nice... I'll take a look. |
Does anyone have any experience using this script in a Wordpress environment where the root is read-only? This means that our images are being processed using the WP-Read-Only plugin (http://wordpress.org/extend/plugins/wpro/) using Amazon's S3 buckets to store our images. Does this plugin work on images at external URLs? Does it require a cache folder to be writable on the server? I'm currently hosting the Wordpress site on Heroku with a custom PHP buildpack and Heroku Postgres as the database. I'd love to be able to use this for a new responsive site but I'm not sure if it works on images hosted on S3. |
I think to remember that it does not work with remote images... |
If AI is not working, you must ensure that .htaccess is not being altered by another .htaccess inside a child folder on your installation (in my case was a .htaccess inside wordpress folder) |
I got it working fine in a sub-directory. Since I am running a multi-site installation, I put the files in /wp-content/blogs.dir/# (where # is the upload directory for my site), made the necessary changes to the paths in the files, and kabang! it worked like a charm. |
Has anybody had any conflicts with running ai.php and W3 Total Cache? |
Since my post 2 months ago, I've finally started using a smartphone -- ai.php no longer seems to work (not seeing any cache directories being created when I visit the site on the phone). I do have W3TC enabled on the network; it could be part of the problem? |
Hmmm, yeah, maybe. So you just decided to go with caching via W3 instead of serving adaptive images? |
No, using both. Caching to speed things up for everybody; adaptive images to speed things up for mobile users. Though my experience w/ W3 is that it's a PITA. Can't use the minify feature because it screws up some of my scripts. |
per your last comment, you said that ai.php is no longer working on mobile. So it seems that W3 may be the issue. What about ai.php with other devices |
When I tested it w/ a responsive testing bookmarklet (which had worked 2 months ago), I got no joy. But the other possibility here is that the javascript isn't loading fast enough — I can't get it to load before jQuery. |
hmm, not sure there. |
yeah, I am testing ai.php by reloading screen size, then reloading. When I inspect image it the large image being resized. |
I did this to force it to load 1st, but jQuery still loads before it for reasons I can't fathom. Hard-coding it into header.php doesn't work either; Wordpress loads jQuery 1st: if (!is_admin()) {
// Deregister already loaded script
wp_deregister_script('jquery');
// Register & enqueue Adaptive Image script; must load 1st
function scripts_important()
{
// Register script
wp_register_script( 'adaptive_image', get_stylesheet_directory_uri() . '/path_to_scripts/adaptive-image.js' );
// Enqueue script
wp_enqueue_script( 'adaptive_image' );
}
add_action( 'wp_enqueue_scripts', 'scripts_important', 1 );
// Reload CDN
wp_register_script('jquery', ('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'), false);
wp_enqueue_script('jquery');
// Register custom scripts (must load after jQuery)
wp_register_script('my_custom_script', get_stylesheet_directory_uri().'/path_to_scripts/my_custom_script.js',false);
// Enqueue scripts
wp_enqueue_script('my_custom_script');
} |
what theme or starter theme are you using.? |
I created a child-theme of a commercial theme: Area 53 from WPscientist. The website is http://mercury-photo.com; surf on over on your tablet or phone & I'll look to see whether it triggered any adaptive cache action. |
Did it trigger? The load time was slow both 1st and second time. iPhone 4S. Chrome. One thought is to conditionally load the "green grass" background image. Seth Hall On Friday, May 10, 2013 at 3:25 PM, seezee wrote:
|
Ah, unfortunately, it did not. I'll need to polish up my PHP before tackling the background slider. The plugin that loads it is supposed to run only on the home page, but I've never been able to get that feature to work. I'm betting that the social buttons (lower left corner) also slow load time; I've been thinking of removing them. http://www.tnooz.com/2011/10/13/news/why-we-dumped-the-google-plus-button-from-the-front-page-of-our-travel-search-site/ |
Anyone get this properly figured out yet? I've got Adaptive Images running perfectly on my local environment. When I set it up on a live server, I get 404s on all my images. Here's my setup:
Based on that, I believe I need to update something in |
Ok, I FINALLY got this up and running. Here's a complete step-by-step for anyone else who's having trouble: 1. Modify your
|
Thanks so much for that thorough WordPress guide! I'm sure it'll help a lot of people :) Do you mind if I include it in the main Adaptive Images site at some point? (The website is moving up my list of 'hey, you need to get this stuff updated' items). |
@MattWilcox - That would be awesome. I just made a few minor updates to the post for better clarity and consistency. Feel free to use it on the site, and thanks for building such an awesome tool. It helped me reduce file size by over 80-something % for some applications. |
Hey Cferdinandi -- Trying to follow this and got to a point where test.jpg replaces all of the theme images (logo, social etc) but doesn't seem to touch anything in wp-content/uploads -- which makes very little sense to me. Did you ever run into that? Cheers -m |
Really odd - never seen that before! Last month someone tipped me off about Photon, which is built into the Jetpack plugin. It essentially does the same thing as Adaptive Images, but without the need to configure anything. If your comfortable with WordPress.com hosting and serving the images, it might be another option to consider. |
Cool! thanks! |
You should create a wiki page with this content #22 (comment) That would allow better change tracking and updating. |
Why not change all the 'RewriteCond %{REQUEST_URI} !xxx' rules to just one rule 'RewriteCond %{REQUEST_URI} wp-content/uploads/' (that's without the preceding exclamation point (!)) since Wordpress uses only that directory for uploaded images? |
Just a note for anyone trying to test by setting a resolution 480 cookie: the javascript cookie setting code advised in the instructions above under 'Test' does not work (quotes around the 480). Use the following code instead:
|
@cferdinandi Thank you so much for your guide. Really helped. There is a another WP plugin for Adaptive Images here: http://wordpress.org/plugins/new-nine-adaptive-images/ I couldn't get it to work until I read your troubleshooting section - the plugin assumes a default install with everything under the /wordpress folder. I posted some steps to fix that here: http://wordpress.org/support/topic/doesnt-work-automatically-if-you-install-wp-in-a-subfolder-fix-included EDIT 5/9/14 Plugin was removed from the WP plugin repo due to license incompatibility. http://wordpress.org/support/topic/license-violation-1
|
@willthemoor - Glad I was able to help! |
Has anyone figured out how to install this into a WordPress multisite installation? When I follow instructions, everything seems to work on main site, but on sub-sites, images are broken. It only breaks images inside of wp-content/uploads directory on sub-sites. |
4.Test without a small screen device The following code for changing the cookie in header.php didn't work for me:
I had to change it to:
|
Hey @andrew5555 and anyone else who comes here in the future and is hoping to get this to work on a Wordpress Multisite installation. I was able to get this working on our project by adding 1 line of code to adaptive-images.php After:
Simply cut off the root folder for the sub-pages by adding:
I can't promise this will work for you all, but it worked for me. Good luck. |
** Notez que je serai absent du bureau du 18 au 29 juillet 2014 (de retour le 29 juillet). Je répondrai à mes courriels moins rapidement qu'à l'habitude. Pour une urgence, veuillez communiquer avec Pierre-Luc Lamothe (extension 101) ou avec François Drolet (extension 105) pour le support technique du service d'hébergement web. Keven Marin, Directeur des solutions web +1 888 959-6352 x102 | www.collectiv.ca |
Hi, |
@cferdinandi I would have asked that could please elaborate the reason you place |
@tlehtimaki I actually don't remember! It's been a while since I used this. |
Just a heads up for everyone: now that WordPress has baked responsive image support into the core, I'm not sure this is the best approach to mobile-friendly image delivery anymore. |
Having trouble with your Wordpress install? Please comment here.
Remember that any problems are very likely to be something with your server configuration or Wordpress set up. As those things can be so varied, please can you give as much info as possible about them "it doesn't work" isn't enough for anyone to help you :)
Are you running WP on a domain or in a sub-folder of a domain? Are you running any plugins or themes that may be making use of a .htaccess file? What server and software versions are you running? etc. Everything you think might be relevant. Thanks.
The text was updated successfully, but these errors were encountered: