This question may be related to a resolved thread.
EE 2.5.2
Windows 7 64-bit
Hello!
I have a File field which I’m using to upload an image on Windows. I’m receiving the error “Thumbnail could not be created for the image. Please make sure the thumbnail directory is writable”.
I’ve confirmed that my paths exist and are writable.
Inside of Image_lib.php, the destination path for image thumbnails gets messed up. As a result, EE is unable to write the image file.
The problem occurs on line 212 in Image_lib.php.
if (strpos($this->new_image, DIRECTORY_SEPARATOR) === FALSE)It bases a conditional statement on DIRECTORY_SEPARATOR (aka “\” in Windows). The problem is that $this->new_image has unix-style separators (i.e. “/”). Therefore the conditional on line 212 evaluates incorrectly.
I printed out the paths during the process and you can see where it goes awry:
$this->new_image: d:/ee/images/uploads/_thumbs/temp_file_issue_71.jpgLine 212 will not find DIRECTORY_SEPARATOR in this image path and it will assign this full path to $this->dest_image. dest_image is expected to be only the image name. Later, this full path gets combined with $this->dest_folder which results in a “doubled” image path (see $this->full_dst_path). At that point, EE is unable to save the image.
$this->dest_image: d:/ee/images/uploads/_thumbs/temp_file_issue_71.jpg
$this->dest_folder: d:/ee/images/uploads/
$this->full_src_path : d:/ee/images/uploads/temp_file_issue_71.jpg
$this->full_dst_path : d:/ee/images/uploads/d:/ee/images/uploads/_thumbs/temp_file_issue_71.jpgSo, it’s not Image_lib’s fault but for now I’ve stuck this hack on line 212:
if (DIRECTORY_SEPARATOR=="\\") $this->new_image = str_replace('/',DIRECTORY_SEPARATOR, $this->new_image);
Could something in my config be causing this?