示例#1
0
 public function postDel(Request $request, $img_id)
 {
     $res = ['response' => 'YES', 'status' => 0];
     $img = Img::findOrFail($img_id);
     if ($img->img_active == 0) {
         if (file_exists(public_path() . $img->img_hd)) {
             unlink(public_path() . $img->img_hd);
         }
         if (file_exists(public_path() . $img->img_big)) {
             unlink(public_path() . $img->img_big);
         }
         if (file_exists(public_path() . $img->img_small)) {
             unlink(public_path() . $img->img_small);
         }
         if (file_exists(public_path() . $img->img_tiny)) {
             unlink(public_path() . $img->img_tiny);
         }
         if (file_exists(public_path() . $img->img_square)) {
             unlink(public_path() . $img->img_square);
         }
         if (file_exists(public_path() . $img->img_uri)) {
             unlink(public_path() . $img->img_uri);
         }
         $p = !file_exists(public_path() . $img->img_hd) && !file_exists(public_path() . $img->img_big) && !file_exists(public_path() . $img->img_small) && !file_exists(public_path() . $img->img_tiny) && !file_exists(public_path() . $img->img_uri);
         if ($p) {
             $img->forceDelete();
             if (!Img::find($img_id)) {
                 $res['status'] = 1;
             } else {
                 $res['msgError'] = MSG_FA;
             }
         } else {
             $res['msgError'] = '出错了...';
         }
     } else {
         $res['msgError'] = '该图片正在被使用,请先删除相关关联,再试';
     }
     return response()->json($res);
 }
示例#2
0
		'selector'=>'.froalaEditor',
		'options'=>[
			'height'=>'300',
			],
		])

	<script type="text/javascript">
		<?php 
$img = '';
$imgId = 0;
$imgUrl = '';
if ($product) {
    $img = $product->Img()->first();
}
if (old('product_img_id')) {
    $img = \App\Img::find(old('product_img_id'));
}
if ($img) {
    $imgId = $img->img_id;
    $imgUrl = $img->img_small;
}
?>

		$('#uploadZone').myDropzone({
			uploadUrl: '/img/upload/public',
			uploadField: 'product_img_id',
			rowNumber:1,
			limited:1,
		});

		$('#uploadZone').myDropzoneInsertImg({
示例#3
0
			rowNumber:1,
			limited:1,
		});

		$('#uploadZone1').myDropzoneInsertImg({
			uploadField:  'activity_img_icon',
			imgId: '{{$imgId}}',
			imgUrl: '{{$imgUrl}}',
		});

		<?php 
$img = '';
$imgId = 0;
$imgUrl = '';
if (old('activity_img_bg')) {
    $img = \App\Img::find(old('activity_img_bg'));
}
if ($img) {
    $imgId = $img->img_id;
    $imgUrl = $img->img_small;
}
?>
		
		$('#uploadZone2').myDropzone({
			uploadUrl: '/img/upload/public',
			uploadField: 'activity_img_bg',
			rowNumber:1,
			limited:1,
		});

		$('#uploadZone2').myDropzoneInsertImg({
示例#4
0

@section('js_extra')
	@include('layouts.plugin.dropzoneUpload.multiple-js')
	@include('manage.img.imgbox-js')

	<script type="text/javascript">
		<?php 
$img = '';
$imgId = 0;
$imgUrl = '';
if ($banner) {
    $img = $banner->Img_main()->first();
}
if (old('banner_img_main')) {
    $img = \App\Img::find(old('banner_img_main'));
}
if ($img) {
    $imgId = $img->img_id;
    $imgUrl = $img->img_small;
}
?>

		$('#uploadZone').myDropzone({
			uploadUrl: '/img/upload/public',
			uploadField:  'banner_img_main',
			uploadTips: '点击或拖拽上传',
			rowNumber:1,
			limited:1,
		});
示例#5
0
 public function postUpdate(FormPRequest $request, $form_code)
 {
     $form = Form::where('form_code', '=', $form_code)->where('form_type', 'template')->firstOrFail();
     $inputs = $request->only('form_title', 'form_summary', 'form_desc', 'form_sort', 'form_active');
     if ($inputs['form_active'] == '') {
         $inputs['form_active'] = 0;
     }
     $inputs['form_img_thumbnail'] = $request->input('form_img_thumbnail', 0);
     // img处理
     $img = $form->Img_thumbnail()->first();
     if ($img && $img->img_id != $inputs['form_img_thumbnail']) {
         $img->decouple();
     }
     $form = $form->update($inputs);
     if ($inputs['form_img_thumbnail']) {
         Img::find($inputs['form_img_thumbnail'])->relation();
     }
     if ($form) {
         $res = redirect('/manage/template/list')->with('msgSuccess', MSG_SU);
     } else {
         $res = redirect()->back()->with('msgError', MSG_FA);
     }
     return $res;
 }
示例#6
0
	$('#uploadZone').myDropzone({
		uploadUrl: '/img/upload/public',
		uploadField: 'form_img_thumbnail',
		rowNumber:1,
		limited:1,
	});

	<?php 
$img = '';
$imgId = 0;
$imgUrl = '';
if ($form) {
    $img = $form->Img_thumbnail()->first();
}
if (old('form_img_thumbnail')) {
    $img = \App\Img::find(old('form_img_thumbnail'));
}
if ($img) {
    $imgId = $img->img_id;
    $imgUrl = $img->img_small;
}
?>

	$('#uploadZone').myDropzoneInsertImg({
		uploadField:  'form_img_thumbnail',
		imgId: '{{$imgId}}',
		imgUrl: '{{$imgUrl}}',
	});

	$(function(){