From: Joshua Rüsweg Date: Sun, 20 Jan 2019 21:50:27 +0000 (+0100) Subject: Add method to set a custom image link X-Git-Tag: 5.2.0_Alpha_1~296^2~26 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a4bb0c33c2ec577a1fa3c7c9dbf618037d15242;p=GitHub%2FWoltLab%2FWCF.git Add method to set a custom image link See #2825 --- 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. *