mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-11 18:46:49 +00:00
Minor Reorg
This commit is contained in:
@@ -103,8 +103,17 @@ class Drawing extends BaseDrawing
|
||||
}
|
||||
|
||||
$this->path = '';
|
||||
if ($zip instanceof ZipArchive) {
|
||||
$zipPath = explode('#', $path)[1];
|
||||
$locate = @$zip->locateName($zipPath);
|
||||
if ($locate !== false) {
|
||||
if ($this->isImage($path)) {
|
||||
$this->path = $path;
|
||||
$this->setSizesAndType($path);
|
||||
}
|
||||
}
|
||||
// Check if a URL has been passed. https://stackoverflow.com/a/2058596/1252979
|
||||
if (filter_var($path, FILTER_VALIDATE_URL) || (preg_match('/^([\w\s\x00-\x1f]+):/u', $path) && !preg_match('/^([\w]+):/u', $path))) {
|
||||
} elseif (filter_var($path, FILTER_VALIDATE_URL) || (preg_match('/^([\w\s\x00-\x1f]+):/u', $path) && !preg_match('/^([\w]+):/u', $path))) {
|
||||
if (!preg_match('/^(http|https|file|ftp|s3):/', $path)) {
|
||||
throw new PhpSpreadsheetException('Invalid protocol for linked drawing');
|
||||
}
|
||||
@@ -148,15 +157,6 @@ class Drawing extends BaseDrawing
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($zip instanceof ZipArchive) {
|
||||
$zipPath = explode('#', $path)[1];
|
||||
$locate = @$zip->locateName($zipPath);
|
||||
if ($locate !== false) {
|
||||
if ($this->isImage($path)) {
|
||||
$this->path = $path;
|
||||
$this->setSizesAndType($path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$exists = @file_exists($path);
|
||||
if ($exists !== false && $this->isImage($path)) {
|
||||
|
||||
Reference in New Issue
Block a user