1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-07-31 21:40:12 +02:00

Build to prepare to tag

This commit is contained in:
Mikael Roos
2022-11-17 16:07:35 +01:00
parent bb57af697b
commit 1666ea1412
4 changed files with 43 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
// Version of cimage and img.php // Version of cimage and img.php
define("CIMAGE_VERSION", "v0.8.4 (2022-05-30)"); define("CIMAGE_VERSION", "v0.8.5 (2022-11-17)");
// For CRemoteImage // For CRemoteImage
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION); define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);

View File

@@ -38,7 +38,7 @@ $config = array(
// Version of cimage and img.php // Version of cimage and img.php
define("CIMAGE_VERSION", "v0.8.4 (2022-05-30)"); define("CIMAGE_VERSION", "v0.8.5 (2022-11-17)");
// For CRemoteImage // For CRemoteImage
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION); define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
@@ -465,7 +465,7 @@ class CHttpGet
{ {
$type = isset($this->response['header']['Content-Type']) $type = isset($this->response['header']['Content-Type'])
? $this->response['header']['Content-Type'] ? $this->response['header']['Content-Type']
: null; : '';
return preg_match('#[a-z]+/[a-z]+#', $type) return preg_match('#[a-z]+/[a-z]+#', $type)
? $type ? $type
@@ -2101,8 +2101,11 @@ class CImage
{ {
$file = $file ? $file : $this->pathToImage; $file = $file ? $file : $this->pathToImage;
is_readable($file) // Special case to solve Windows 2 WSL integration
or $this->raiseError('Image file does not exist.'); if (!defined('WINDOWS2WSL')) {
is_readable($file)
or $this->raiseError('Image file does not exist.');
}
$info = list($this->width, $this->height, $this->fileType) = getimagesize($file); $info = list($this->width, $this->height, $this->fileType) = getimagesize($file);
if (empty($info)) { if (empty($info)) {
@@ -3577,8 +3580,10 @@ class CImage
return; return;
} }
is_writable($this->saveFolder) if (!defined("WINDOWS2WSL")) {
is_writable($this->saveFolder)
or $this->raiseError('Target directory is not writable.'); or $this->raiseError('Target directory is not writable.');
}
$type = $this->getTargetImageExtension(); $type = $this->getTargetImageExtension();
$this->Log("Saving image as " . $type); $this->Log("Saving image as " . $type);
@@ -4140,6 +4145,15 @@ class CCache
return $path; 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)) { if ($create && is_writable($this->path)) {
$path = $this->path . "/" . $subdir; $path = $this->path . "/" . $subdir;

View File

@@ -38,7 +38,7 @@ $config = array(
// Version of cimage and img.php // Version of cimage and img.php
define("CIMAGE_VERSION", "v0.8.4 (2022-05-30)"); define("CIMAGE_VERSION", "v0.8.5 (2022-11-17)");
// For CRemoteImage // For CRemoteImage
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION); define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
@@ -465,7 +465,7 @@ class CHttpGet
{ {
$type = isset($this->response['header']['Content-Type']) $type = isset($this->response['header']['Content-Type'])
? $this->response['header']['Content-Type'] ? $this->response['header']['Content-Type']
: null; : '';
return preg_match('#[a-z]+/[a-z]+#', $type) return preg_match('#[a-z]+/[a-z]+#', $type)
? $type ? $type
@@ -2101,8 +2101,11 @@ class CImage
{ {
$file = $file ? $file : $this->pathToImage; $file = $file ? $file : $this->pathToImage;
is_readable($file) // Special case to solve Windows 2 WSL integration
or $this->raiseError('Image file does not exist.'); if (!defined('WINDOWS2WSL')) {
is_readable($file)
or $this->raiseError('Image file does not exist.');
}
$info = list($this->width, $this->height, $this->fileType) = getimagesize($file); $info = list($this->width, $this->height, $this->fileType) = getimagesize($file);
if (empty($info)) { if (empty($info)) {
@@ -3577,8 +3580,10 @@ class CImage
return; return;
} }
is_writable($this->saveFolder) if (!defined("WINDOWS2WSL")) {
is_writable($this->saveFolder)
or $this->raiseError('Target directory is not writable.'); or $this->raiseError('Target directory is not writable.');
}
$type = $this->getTargetImageExtension(); $type = $this->getTargetImageExtension();
$this->Log("Saving image as " . $type); $this->Log("Saving image as " . $type);
@@ -4140,6 +4145,15 @@ class CCache
return $path; 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)) { if ($create && is_writable($this->path)) {
$path = $this->path . "/" . $subdir; $path = $this->path . "/" . $subdir;

File diff suppressed because one or more lines are too long