From 4a4bb0c33c2ec577a1fa3c7c9dbf618037d15242 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sun, 20 Jan 2019 22:50:27 +0100 Subject: [PATCH] Add method to set a custom image link See #2825 --- .../system/file/upload/UploadFile.class.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php b/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php index 615e8642da..deba057abd 100644 --- a/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php +++ b/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php @@ -1,5 +1,6 @@ processed) { - return $this->location; + if ($this->imageLink === null) { + // try to guess path + return str_replace(WCF_DIR, WCF::getPath(), $this->location); + } + else { + return $this->imageLink; + } } else { $imageData = getimagesize($this->location); @@ -150,6 +163,15 @@ class UploadFile { $this->processed = true; } + /** + * Sets the new image link of the file for processed files. + * + * @param string $link + */ + public function setImageLink($link) { + $this->imageLink = $link; + } + /** * Returns true, if the file is already processed. * -- 2.20.1