I am still working on a D6 Ubercart programmatic conversion to Backdrop, and coming up against image styles now.

I have a fresh site with the Ubercart Image styles all in there...but image handling seems to be broken or barely functional before I even start to convert from the Image Cache ways of doing things.

For instance, in manually creating a new product I end up with : 

Where the missing image is http://devsite.local/files/styles/uc_product_list/public/img_20190609_11...
So is there some documentation somewhere on what it's supposed to do, because it didn't create that file from the uploaded image?

Most helpful answers

In the off-chance this is related, let's start with:

Comments

Do image styles work in general on this site? (ie. Is this an Ubercart image styles issue or a more general Backdrop image styles issue on this local install?)

Good question, and yes, even creating a Post and attaching an image, I see that the thumbnail system is broken before saving.

My media settings:

Yes, Nginx is in use.
the lines 

# To override the above rule, match more specifically against the image styles directory.
    location ^~ /files/styles/ {
        try_files $uri @rewrite;
    }

 

haven't helped, unfortunately. I did do nginx restart.

But will continue to poke the environment, as I suspect it is something in the local dev that is causing this.

If I go to the Image styles area, list them, click configure, I can see the thumbnail of the balloons. I can then check that it creates the necessary files in files/styles. No problem.


If I try to create any content and add an image for it, I get the failure to create the thumbnail, and upon inspection F12, see:

fdcxursxeao8puk.jpeg:1          GET http://devsite.local/files/styles/thumbnail/public/field/image/fdcxursxe... 500 (Internal Server Error)

So it does appear to be NGinx 500 server error issue.

Aha! Logs show:

 ...rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/files/styles/thumbnail/public/field/image/fdcxursxeao8puk.jpeg", client: 127.0.0.1,...

My nginx conf file:
server {
listen 80;
server_name server_name devsite.local ;
location / {
root /home/onyx/htdocs/sites/devsite;
index index.php;
error_page 404 = @backdrop;
}
 location ^~ /files/styles/ {
        try_files $uri @rewrite;
    }
location @backdrop { rewrite ^(.*)$ /index.php?q=$1 last; }
}

Absolutely vanilla...but still have this problem, so it must be a part of the PHP code doing an internal redirect to bounce on index.php so many times?

quicksketch's picture

I believe nginx processes rules top to bottom, with the last rule taking precedence. Though specificity also matters (i.e. using = vs ~= vs no operator, the more specific operator wins). Maybe try moving your files rewrite below the general location "@backdrop" rewrite?

I usually use the following rules:

  # Try checking if the file exists physically before calling index.php (a la mod_rewrite in Apache).
  location / {
    try_files $uri @rewrite;
  }

  location @rewrite {
    rewrite ^/(.*)$ /index.php?q=$1;
  }

  # To override the above rule, match more specifically against the image styles directory.
  location ^~ /files/styles/ {
    try_files $uri @rewrite;
  }

 

 

quicksketch's picture

Also, looking at your code, you have:

try_files $uri @rewrite;

But your location code is:

location @backdrop

It might just be that you need to replace @rewrite with @backdrop (or vice-versa). The location @rewrite may not exist in your conf file.

Thanks for trying;

after modding conf to this:

server {
listen 80;
server_name server_name devsite.local ;

root /home/onyx/htdocs/sites/devsite;
index index.php;
  location / {
      try_files $uri @rewrite;
    }

    location @rewrite {
      rewrite ^/(.*)$ /index.php?q=$1;
    }

    # To override the above rule, match more specifically against the image styles directory.
    location ^~ /files/styles/ {
      try_files $uri @rewrite;
    }

}

there is still no difference, still throws a 500 with the endless internal redirect.

jenlampton's picture

Nate previously recommended:

Maybe try moving your files rewrite below the general location rewrite?

Have you tried that yet? Your latest example still shows files first. 

Thanks Jen, yes, I've tried all combinations...same result. Baffling. I'm missing something...