mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-20 09:22:56 +00:00
上传图片
This commit is contained in:
parent
76000e3434
commit
52c87ba750
@ -155,7 +155,7 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public static function thumb($filePath, $ratio=8, $pre='s_')
|
public static function thumb($filePath, $ratio=8, $pre='s_')
|
||||||
{
|
{
|
||||||
$filePath = '.'.ltrim($filePath,'.');
|
$filePath = ROOT_PATH.ltrim(ltrim($filePath,'.'),'/');
|
||||||
$img = self::openImage($filePath);
|
$img = self::openImage($filePath);
|
||||||
$width = $img->width() * $ratio / 10;
|
$width = $img->width() * $ratio / 10;
|
||||||
$height = $img->height() * $ratio / 10;
|
$height = $img->height() * $ratio / 10;
|
||||||
@ -163,6 +163,7 @@ class UploadService
|
|||||||
$fileName = basename($filePath);
|
$fileName = basename($filePath);
|
||||||
$savePath = $dir.DS.$pre.$fileName;
|
$savePath = $dir.DS.$pre.$fileName;
|
||||||
$img->thumb($width,$height)->save($savePath);
|
$img->thumb($width,$height)->save($savePath);
|
||||||
|
$savePath = str_replace(ROOT_PATH,'',$savePath);
|
||||||
return ltrim($savePath,'.');
|
return ltrim($savePath,'.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user