mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-15 21:32:50 +00:00
修改入口文件 调整上传图片路径
This commit is contained in:
parent
b551e20fc1
commit
c7276be4b0
@ -57,8 +57,6 @@ class Images extends AuthController
|
|||||||
$thumbPath = Upload::thumb($res->dir);
|
$thumbPath = Upload::thumb($res->dir);
|
||||||
//产品图片上传记录
|
//产品图片上传记录
|
||||||
$fileInfo = $res->fileInfo->getinfo();
|
$fileInfo = $res->fileInfo->getinfo();
|
||||||
//入口是public需要替换图片路径
|
|
||||||
$res->dir = str_replace('public/uploads','',$res->dir);
|
|
||||||
SystemAttachmentModel::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,$thumbPath,$pid);
|
SystemAttachmentModel::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,$thumbPath,$pid);
|
||||||
$info = array(
|
$info = array(
|
||||||
// "originalName" => $fileInfo['name'],
|
// "originalName" => $fileInfo['name'],
|
||||||
@ -94,8 +92,14 @@ class Images extends AuthController
|
|||||||
public function deleteimganddata($att_id){
|
public function deleteimganddata($att_id){
|
||||||
$attinfo = SystemAttachmentModel::get($att_id)->toArray();
|
$attinfo = SystemAttachmentModel::get($att_id)->toArray();
|
||||||
if($attinfo){
|
if($attinfo){
|
||||||
@unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'.'));
|
if(strpos($attinfo['att_dir'],'public') !== false){
|
||||||
@unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'.'));
|
@unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'/'));
|
||||||
|
@unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'/'));
|
||||||
|
}else{
|
||||||
|
@unlink(ROOT_PATH.ltrim('public'.$attinfo['att_dir'],'/'));
|
||||||
|
@unlink(ROOT_PATH.ltrim('public'.$attinfo['satt_dir'],'/'));
|
||||||
|
}
|
||||||
|
|
||||||
SystemAttachmentModel::where(['att_id'=>$att_id])->delete();
|
SystemAttachmentModel::where(['att_id'=>$att_id])->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,13 +119,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<button type="button" class="btn btn-w-m btn-info" style="width: 100%;" @click="submit">提交保存图文</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8" style="position: fixed;right:44px;bottom: 0;z-index: 999;text-align: right">
|
|
||||||
<button type="button" class="btn btn-w-m btn-info" style="width: 100%;" @click="submit">提交保存图文</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
{volist name="list" id="vo"}
|
{volist name="list" id="vo"}
|
||||||
<div class="image-item">
|
<div class="image-item">
|
||||||
<div class="image-delete" data-url="{:Url('delete',array('att_id'=>$vo.att_id))}"></div>
|
<div class="image-delete" data-url="{:Url('delete',array('att_id'=>$vo.att_id))}"></div>
|
||||||
<img class="pic" src="{__UPLOAD_PATH}{$vo.att_dir|ltrim='.'}" id="{$vo.att_id}"/>
|
<img class="pic" src="{$vo.att_dir|ltrim='.'}" id="{$vo.att_id}"/>
|
||||||
</div>
|
</div>
|
||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
function sensitive_words_filter($str)
|
function sensitive_words_filter($str)
|
||||||
{
|
{
|
||||||
if (!$str) return '';
|
if (!$str) return '';
|
||||||
$file = ROOT_PATH. PUBILC_PATH.'static/plug/censorwords/CensorWords';
|
$file = ROOT_PATH. PUBILC_PATH.'/static/plug/censorwords/CensorWords';
|
||||||
$words = file($file);
|
$words = file($file);
|
||||||
foreach($words as $word)
|
foreach($words as $word)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -144,14 +144,13 @@ return [
|
|||||||
|
|
||||||
// 视图输出字符串内容替换
|
// 视图输出字符串内容替换
|
||||||
'view_replace_str' => [
|
'view_replace_str' => [
|
||||||
'{__ADMIN_PATH}'=>PUBILC_PATH.'system/',
|
'{__ADMIN_PATH}'=>PUBILC_PATH.'/system/',
|
||||||
'{__FRAME_PATH}'=>PUBILC_PATH.'system/frame/',
|
'{__FRAME_PATH}'=>PUBILC_PATH.'/system/frame/',
|
||||||
'{__PLUG_PATH}'=>PUBILC_PATH.'static/plug/',
|
'{__PLUG_PATH}'=>PUBILC_PATH.'/static/plug/',
|
||||||
'{__MODULE_PATH}'=>PUBILC_PATH.'system/module/',
|
'{__MODULE_PATH}'=>PUBILC_PATH.'/system/module/',
|
||||||
'{__STATIC_PATH}'=>PUBILC_PATH.'static/',
|
'{__STATIC_PATH}'=>PUBILC_PATH.'/static/',
|
||||||
'{__PUBLIC_PATH}'=>PUBILC_PATH,
|
'{__PUBLIC_PATH}'=>PUBILC_PATH.'/',
|
||||||
'{__UPLOAD_PATH}'=>UPLOAD_PATH,
|
'{__WAP_PATH}'=>PUBILC_PATH.'/wap/first/static/'
|
||||||
'{__WAP_PATH}'=>PUBILC_PATH.'wap/first/static/'
|
|
||||||
],
|
],
|
||||||
// 默认跳转页面对应的模板文件
|
// 默认跳转页面对应的模板文件
|
||||||
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
|
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
|
||||||
|
|||||||
@ -47,7 +47,11 @@ class UploadService
|
|||||||
self::$uploadStatus->filePath = self::pathToUrl($filePath);
|
self::$uploadStatus->filePath = self::pathToUrl($filePath);
|
||||||
self::$uploadStatus->fileInfo = $fileInfo;
|
self::$uploadStatus->fileInfo = $fileInfo;
|
||||||
self::$uploadStatus->uploadPath = $path;
|
self::$uploadStatus->uploadPath = $path;
|
||||||
self::$uploadStatus->dir = $filePath;
|
if(strpos(PUBILC_PATH,'public') !== false){
|
||||||
|
self::$uploadStatus->dir = $filePath;
|
||||||
|
}else{
|
||||||
|
self::$uploadStatus->dir = str_replace('/public','',$filePath);
|
||||||
|
}
|
||||||
self::$uploadStatus->status = true;
|
self::$uploadStatus->status = true;
|
||||||
return self::$uploadStatus;
|
return self::$uploadStatus;
|
||||||
}
|
}
|
||||||
@ -79,7 +83,7 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
protected static function uploadDir($path, $root=null)
|
protected static function uploadDir($path, $root=null)
|
||||||
{
|
{
|
||||||
if($root === null) $root = 'public/' . 'uploads';
|
if($root === null) $root = UPLOAD_PATH;
|
||||||
return $root . DS . $path;
|
return $root . DS . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +159,7 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public static function thumb($filePath, $ratio=8, $pre='s_')
|
public static function thumb($filePath, $ratio=8, $pre='s_')
|
||||||
{
|
{
|
||||||
$filePath = ROOT_PATH.ltrim(ltrim($filePath,'.'),'/');
|
$filePath = 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,7 +167,6 @@ 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.'public/uploads','',$savePath);
|
return DS.$savePath;
|
||||||
return ltrim($savePath,'.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,8 +24,8 @@ if(file_exists("./public/install/") && !file_exists("./public/install/install.lo
|
|||||||
// 定义应用目录
|
// 定义应用目录
|
||||||
define('APP_PATH', __DIR__ . '/application/');
|
define('APP_PATH', __DIR__ . '/application/');
|
||||||
//静态文件目录
|
//静态文件目录
|
||||||
define('PUBILC_PATH', '/public/');
|
define('PUBILC_PATH', '/public');
|
||||||
//上传文件目录
|
//上传文件目录
|
||||||
define('UPLOAD_PATH', '/public/uploads');
|
define('UPLOAD_PATH', 'public/uploads');
|
||||||
// 加载框架引导文件
|
// 加载框架引导文件
|
||||||
require __DIR__ . '/thinkphp/start.php';
|
require __DIR__ . '/thinkphp/start.php';
|
||||||
|
|||||||
@ -24,8 +24,8 @@ if(file_exists("./install/") && !file_exists("./install/install.lock")){
|
|||||||
// 定义应用目录
|
// 定义应用目录
|
||||||
define('APP_PATH', __DIR__ . '/../application/');
|
define('APP_PATH', __DIR__ . '/../application/');
|
||||||
//静态文件目录
|
//静态文件目录
|
||||||
define('PUBILC_PATH', '/');
|
define('PUBILC_PATH', '');
|
||||||
//上传文件目录
|
//上传文件目录
|
||||||
define('UPLOAD_PATH', '/uploads');
|
define('UPLOAD_PATH', 'public/uploads');
|
||||||
// 加载框架引导文件
|
// 加载框架引导文件
|
||||||
require __DIR__ . '/../thinkphp/start.php';
|
require __DIR__ . '/../thinkphp/start.php';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user