mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-04 15:17:42 +02:00
Enable configuration fix for solving Windows 2 WSL2 issue with is_readable/is_writable #189
This commit is contained in:
@@ -51,6 +51,15 @@ class CCache
|
||||
return $path;
|
||||
}
|
||||
|
||||
if ($create && defined('WINDOWS2WSL')) {
|
||||
// Special case to solve Windows 2 WSL integration
|
||||
$path = $this->path . "/" . $subdir;
|
||||
|
||||
if (mkdir($path)) {
|
||||
return realpath($path);
|
||||
}
|
||||
}
|
||||
|
||||
if ($create && is_writable($this->path)) {
|
||||
$path = $this->path . "/" . $subdir;
|
||||
|
||||
|
@@ -964,8 +964,11 @@ class CImage
|
||||
{
|
||||
$file = $file ? $file : $this->pathToImage;
|
||||
|
||||
// Special case to solve Windows 2 WSL integration
|
||||
if (!defined('WINDOWS2WSL')) {
|
||||
is_readable($file)
|
||||
or $this->raiseError('Image file does not exist.');
|
||||
}
|
||||
|
||||
$info = list($this->width, $this->height, $this->fileType) = getimagesize($file);
|
||||
if (empty($info)) {
|
||||
|
@@ -5,6 +5,14 @@ Revision history
|
||||
[](https://scrutinizer-ci.com/g/mosbth/cimage/build-status/master)
|
||||
|
||||
|
||||
v0.8.5 (2022-11-17)
|
||||
-------------------------------------
|
||||
|
||||
* Enable configuration fix for solving Windows 2 WSL2 issue with is_readable/is_writable #189.
|
||||
* Update CHttpGet.php for php 8.1 deprecated notice #188.
|
||||
|
||||
|
||||
|
||||
v0.8.4 (2022-05-30)
|
||||
-------------------------------------
|
||||
|
||||
|
@@ -21,6 +21,15 @@ if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this if you work with a webserver in Windows and try to access files
|
||||
* within WSL2.
|
||||
* The issue seems to be with functions like `is_writable()` and
|
||||
* `is_readable()`.
|
||||
* When WINDOWS2WSL is defined (to any value) it ignores these functions.
|
||||
*/
|
||||
#define('WINDOWS2WSL', 1);
|
||||
|
||||
|
||||
|
||||
return array(
|
||||
|
Reference in New Issue
Block a user