add origin url
This commit is contained in:
parent
c428ccf8e2
commit
8e16e3a484
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
namespace Beike\Admin\Services;
|
namespace Beike\Admin\Services;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
|
|
||||||
class FileManagerService
|
class FileManagerService
|
||||||
{
|
{
|
||||||
private $fileBasePath = '';
|
private $fileBasePath = '';
|
||||||
|
|
@ -176,6 +174,7 @@ class FileManagerService
|
||||||
'path' => $filePath,
|
'path' => $filePath,
|
||||||
'name' => $baseName,
|
'name' => $baseName,
|
||||||
'url' => image_resize("catalog{$filePath}"),
|
'url' => image_resize("catalog{$filePath}"),
|
||||||
|
'origin_url' => image_origin("catalog{$filePath}"),
|
||||||
'selected' => false,
|
'selected' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,20 @@ function image_resize($image, int $width = 100, int $height = 100)
|
||||||
return (new \Beike\Services\ImageService($image))->resize($width, $height);
|
return (new \Beike\Services\ImageService($image))->resize($width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取原图地址
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
function image_origin($image)
|
||||||
|
{
|
||||||
|
if (Str::startsWith($image, 'http')) {
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
return (new \Beike\Services\ImageService($image))->originUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前语言ID
|
* 当前语言ID
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -61,4 +61,13 @@ class ImageService
|
||||||
}
|
}
|
||||||
return asset($newImage);
|
return asset($newImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取原图地址
|
||||||
|
*/
|
||||||
|
public function originUrl(): string
|
||||||
|
{
|
||||||
|
return asset($this->image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue