humanmade / WPThumb

:warning: UNMAINTAINED :warning: On demand image resizing for WordPress
https://humanmade.co.uk/wpthumb/
170 stars 32 forks source link

Cache folder URL #129

Open Colir opened 9 years ago

Colir commented 9 years ago

Hi. After retrieving a WP's database online, and setting up this one in my localhost, WP Thumb try to get image from cache with this url: locahost/upload/cache\/folder-image/image.jpg

As you see there is a '\' in the cache folder url. if i remove it manually, this work great.

I'm on a Windows machine, and when i install WP with WP Thumb in my localhost, i never encountered this error...

This seems to happen only after retriving a WP's database from online..

Can you help me please.

Thanks you very much

Colir commented 9 years ago

i 've identified the problem. This wrong url appears when i ask to WordPress to not organize my files at upload (directory 'uploads/year/month').

In this case, the generated images by WP Thumb are at the root of the folder 'cache', and the wrong url is generated.

I 've found a patch:

I add this line at line 307

$subdir = dirname( str_replace( $upload_dir['basedir'], '', $this->getFilePath() ) );
if ($subdir == DIRECTORY_SEPARATOR) { $subdir = ''; }

and at line 313

$subdir = dirname( str_replace( WP_CONTENT_DIR, '', $this->getFilePath() ) );
if ($subdir == DIRECTORY_SEPARATOR) { $subdir = ''; }

i will made a pull request

Colir commented 9 years ago

In fact, i didn't understand how to submit this modification in a pull request.