0

I'm using the PHPThumb script to resize image in a little slider/carousel on my blog, www.muylinux.com. I've completed the migration from Cherokee (we had problems with this webserver) to Nginx, but although almost everything is running fine, the carousel does not show the thumbnail generated by PHPThumb, although the image is in fact on the directory it links to.

For example, this is one of the images that should be shown currently:

www.muylinux.com/wp-content/themes/massivenews/scripts/phpThumb/phpThumb.php?src=/wp-content/uploads/2010/11/Unix.jpg&w=186&h=156&zc=T&q=95

And as you can see, the image is there:

www.muylinux.com/wp-content/uploads/2010/11/Unix.jpg

But somehow it doesn't show on the homepage's carousel.

I'm pretty sure it's a matter of some rewrite rule, but I can't see how to solve this.

I've seen that the RewriteRule in Apache should be

RewriteRule ^(.*)$ index.php?thumb=$1 [L,QSA]

I'm not sure the "translation" to an nginx rule could work, but I guess there is a good chance for that to work.

Could someone try to give me the equivalent rewrite rule for Nginx? I've tried this:

rewrite ^/([^?]*)(?:\?(.*))? index.php?thumb=$1$2;

I'm a beginner on this and it has not worked.

2 Answers 2

0

It's a bit of a weird situation if I understand it right, normally you would not rewrite a request to a PHP file to index.php.

The best way to convert RewriteRule ^(.*)$ index.php?thumb=$1 [L,QSA] to Nginx configuration syntax is to use try_files $uri $uri/ /index.php?thumb=$request_uri;

You'd probably need it in your PHP location considering the request is to a PHP script. Might be easier to say if you posted your configuration file.

3
  • In fact I already had a rule similar to that one that solved a past issue with custom permalinks. Nginks and pretty permalinks on WordPress are not so "straightforward" as on Apache or even Cherokee. Anyway, the new line didn't solve the issue. My config file is as follows: pastebin.com/kPUqcxt9
    – javipas
    Nov 28, 2010 at 20:10
  • Plenty of things that's confusing in that Config, for instance your if checks to see if the file exists, those are completely nullified by the try_files. Also you haven't got it in your PHP location as I said to. See here: pastebin.com/j9EiwShR Nov 28, 2010 at 21:29
  • I'm sorry, but didn't work. I've seen the duplicated try_files rule, so I guess one disables the other. Anyway, the problem stays the same: the phpThumb does not find the image, although the path is correct.
    – javipas
    Nov 29, 2010 at 9:26
0

There was finally no need to include a new rewrite rule in order to solve the problem.

The path and the image wasn't found because the plugin directory had not execution permissions.

So in case anyone deals with this issue, just access your WordPress installation,

cd blog_path/wp-content/themes/theme_name

And in my case, inside that folder I had a 'scripts' subfolder which contained the phpThumb scripts. So from that path,

chmod 755 -R scripts/

And... problem solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .