chaoyu/app/widget/manager/Upload.php

72 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace app\widget\manager;
use think\facade\View;
class Upload
{
//视频
public function video($src = '', $append = '')
{
$data = [
'src' => $src,
'append' => $append
];
return View::assign($data)->fetch('manager/widget/video');
}
//图片layui自带上传控件,若同一页面内徐亚加载多层本上传控件则需要传不同的$append来区分控件ID
public function image($src = '', $append = '', $imgSize = 0, $thumb = 0)
{
$data = [
'src' => $src,
'append' => $append,
'imgSize' => $imgSize,
'thumb' => $thumb,
];
return View::assign($data)->fetch('manager/widget/image');
}
//上传文件,目前在文章中添加附件
public function files($files = [], $num = 10, $append = '')
{
if(!empty($files) && $files == 'null') {
$files = [];
}
$data = [
'files' => $files,
'append' => $append,
'num' => $num,
];
return View::assign($data)->fetch('manager/widget/files');
}
/**
* 水印图片上传
* milo
* 2018-01-13
*/
public function mark($src = '')
{
return View::assign(['src' => $src])->fetch('manager/widget/mark');
}
/**
* layui组图上传
* milo
*/
public function multi($imgs = [], $num = 10, $append = '', $imgSize = '')
{
if(!empty($imgs) && $imgs == 'null') {
$imgs = [];
}
$data = [
'imgs' => $imgs,
'append' => $append,
'imgSize' => $imgSize,
'num' => $num
];
return View::assign($data)->fetch('manager/widget/multi');
}
}