2

timthumb.php is a resizing/cropping php script, used in thousands of websites, I'm using it in my wordpress blog, and I'm facing a issue.

I use a plugin that changes the wordpress default's paths for security reasons, like:

Example

Before
mysite.com/wp-content/uploads/2013/03/example.jpg
After
mysite.com/images/example.jpg

timthumb simply won't recognize the new path, it seems to retrieve a 404 error, it can't find the image

My issue:

enter image description here

If you try to access example.jpg directly it works normally, but with timthumb it doesn't mysite.com/images/example.jpg
You can see the image, even if the file is actually in
mysite.com/wp-content/uploads/2013/03/example.jpg
but timthumb won't recognize it and outputs the above error

Current .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^images/(.*) /wp-content/uploads/$1 [QSA,L]
RewriteRule ^lib/(.*) /wp-content/themes/mytheme/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^/wp-content/themes/mytheme/$ lib/ [R,L]
RewriteRule ^/wp-content/uploads/$ images/ [R,L]
RewriteRule ^lib/$ /wp-content/themes/mytheme/ [L,NC]
RewriteRule ^images/$ /wp-content/uploads/ [L,NC]
</IfModule>
Community
  • 1
  • 1
Lucas Bustamante
  • 15,821
  • 7
  • 92
  • 86
  • if you look at the script (It's executed client side). you are calling it in a path context that is not correct for the physical location of the file. .htaccess will not help you in this case. This is because it's executed on the server, not the client side. – CoRe Apr 15 '13 at 04:11

1 Answers1

0

timthumb looks for a path, have you opened and looked to edit the php?

I had to customize timthumb after changing directories as well... I'll look for my code.

timthumb pulls the actual path as it is excecuted server side.

.htaccess is used to pull images from outside thru a web browser.

your files are actually located /public_html/wp-content/uploads/yr/mo/xxxx.xxx

so the script is trying to decode a location that does not exist.

You might be able to ln (soft link the images folder to the uploads folder server side)

this will allow the script to run properly without modification.

CoRe
  • 102
  • 7