duonghien201089 / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Images on WordPress Multisite break the script #206

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Provide a 'src' like: http://yoursite.com/files/2010/10/imagename.jpg OR 
like: http://yoursite.com/wp-content/blogs.dir/1/files/2011/04/imagename.jpg
2. timthumb produces 'file not found' and 'source filename invalid'

WordPress uses a rewrite on the server to serve files from 
/files/Y/m/filename.ext which maps to 
/wp-content/blogs.dir/BLOG_ID/files/Y/m/filename.ext but timthumb does a regex 
on the current 'src' if it's on the same domain and will not find a file at the 
rewrited location. As for the other URL with the blogs.dir, it finds the 
additional dot (from the blogs.dir portion of the URL) and deems it invalid.

The solution for me, was to comment out display_error ('source filename 
invalid'); within the check_external($src) function, and to comment out $host, 
$regex, and $src first three lines of the clean_source($src) function.

I'm sure there's a more elegant solution, but my solution solved my issue the 
quickest.

Original issue reported on code.google.com by sc0ttkclark on 11 Jul 2011 at 4:51

GoogleCodeExporter commented 8 years ago
This is the best solution - 
http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/

Original comment by BinaryMoon on 17 Jul 2011 at 7:53