Active
Project:
Responsive Images
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2011 at 08:40 UTC
Updated:
22 Sep 2011 at 13:44 UTC
The generate .htaccess doesn't work on nginx server. Is there anyone able to convert the below code to nginx rewrite?
# ----------------------------------------------------------------------
# Responsive Images
# ----------------------------------------------------------------------
RewriteCond %{HTTP_COOKIE} rwdimgsize=large
RewriteRule (.*)\/mobile\/(.*)\.r(\.(jpe?g|png|gif))$ $1/desktop/$2$3
# remove .r from all requests
RewriteRule (.*)\.r(\.(jpe?g|png|gif))$ $1$2
# ----------------------------------------------------------------------
# END Responsive Images
# ----------------------------------------------------------------------
The small image is "mobile" and large image is "desktop"
Comments
Comment #1
svendecabooterYou might want to check out https://github.com/filamentgroup/Responsive-Images/pull/12
Not sure if that'll be of any help though...
Comment #2
spacereactor commentedThank, but still couldn't to work. My rewrite fail to generate with .r and definitely I mess up the nginx when I add the cookies in.
Comment #3
omega8cc commentedMaybe try this:
I didn't test it yet, but I think it should work.
FYI: for BOA users - it should got to the nginx_vhost_include.conf file, as explained in http://drupalcode.org/project/octopus.git/blob/HEAD:/docs/HINTS.txt#l16
Comment #4
spacereactor commentedI using #3 but not lucky, and this time there no error in drupal log but it can't generate image with insert ".r"
If anyone can get nginx to work, let me know. Thank
Comment #5
mattfielding commentedThis code definitely works for me
There is a problem getting it to with BOA. The location statement seems to stop it working.
It is because nginx_vhost_include.conf is called into nginx_advanced_include.conf below the following location statement
location ~* /(?:external|system|files/imagecache|files/styles)/ {Which is used for imagecache/images styles
If the include for nginx_vhost_include.conf happens a little earlier then it works fine
Comment #6
omega8cc commented@MattFielding
Thanks for testing!
Added in commit: http://drupalcode.org/project/octopus.git/commit/400bf09
Comment #7
spacereactor commentedi using https://github.com/perusio/drupal-with-nginx setting. where do i add in the code? There no display of image and error like "Unable to generate the derived image located at public://styles/mobile/public/photofile.r.JPG." in my report error log
Below is my nginx domainname conf
Comment #8
omega8cc commented@spacereactor You should put it just before/above
location ~* /imagecache/ {.