PHP code example of netpc / yii2-ueditor

1. Go to this page and download the library: Download netpc/yii2-ueditor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

netpc / yii2-ueditor example snippets


use netpc\ueditor\UEditor;

<?= UEditor::widget([]); //如无设置id和name,默认从w1自动递增 


$config = [
	'components' => [
		'request' => [
			// !!! insert a secret key in the following (if it is empty) - this is ,
			'config' => [
				//server config @see http://fex.baidu.com/ueditor/#server-config
				'imagePathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',//图片
				'scrawlPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',//涂鸦
				'snapscreenPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',//截图
				'catcherPathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',//抓取远程
				'videoPathFormat' => '/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}',//视频
				'filePathFormat' => '/upload/file/{yyyy}{mm}{dd}/{rand:4}_{filename}',//文件文档
				'imageManagerListPath' => '/upload/image/',//图片管理列表
				//'imageUrlPrefix' => '//img.netpc.com.cn',//图片访问路径前缀
				//'imageManagerUrlPrefix' => '//img.netpc.com.cn',//图片管理列表访问路径前缀
				'fileManagerListPath' => '/upload/file/',//文件管理列表
				// 'fileUrlPrefix' => '//file.netpc.com.cn',//图片访问路径前缀
				// 'fileManagerUrlPrefix' => '//file.netpc.com.cn',//文件管理列表访问路径前缀
				// 'webroot' => Yii::getAlias('@frontend/web'),//上传图片文件根目录 默认是当前项目Web
			],
			'resize' => [//修改尺寸,上传图片自动修改为600像素宽度
				'width' => 600,//小于600不处理
				'height' => 0,//高度为0 不限制高度
			],
			'watermark' => [//生成水印需官方扩展支持 composer