|
@@ -22,12 +22,14 @@ class PublicData
|
|
*/
|
|
*/
|
|
public static function saveImageUrl(string $imgUrl)
|
|
public static function saveImageUrl(string $imgUrl)
|
|
{
|
|
{
|
|
-
|
|
+ $baseToRemove = env("OSS_ENDPOINT")."/".env("BUCKET")."/";
|
|
- $parsedUrl = parse_url($imgUrl);
|
|
+
|
|
-
|
|
+ if (strpos($imgUrl, $baseToRemove) === 0) {
|
|
- $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
|
|
+
|
|
-
|
|
+ $result = substr($imgUrl, strlen($baseToRemove));
|
|
- $trimmedPath = ltrim($path, '/');
|
|
+ } else {
|
|
- return $trimmedPath;
|
|
+ $result = $imgUrl;
|
|
|
|
+ }
|
|
|
|
+ return $result;
|
|
}
|
|
}
|
|
}
|
|
}
|