很详细的SpringBoot整合UEditor教程

2017年04月10日 20:27:21 小宝2333 阅读数:21529    版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33745799/article/details/70031641

UEditor只提供JSP版本的后端入口代码。但提供了项目源码,因此可以根据业务需求修改源代码。

此处使用了SpringBoot框架,配备了Thymeleaf模板引擎,所以没有必要再添加jsp来兼容UEditor,可通过修改源码满足需要。下面是详细教程。

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

1.新建SpringBoot项目,添加web和thymeleaf包
很详细的SpringBoot整合UEditor教程 随笔 第1张

pom文件如下:

 

  1.   <?xml version="1.0" encoding="UTF-8"?>
  2.   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4.   <modelVersion>4.0.0</modelVersion>
  5.    
  6.   <groupId>com.example</groupId>
  7.   <artifactId>ueditor-test</artifactId>
  8.   <version>0.0.1-SNAPSHOT</version>
  9.   <packaging>jar</packaging>
  10.    
  11.   <name>ueditor-test</name>
  12.   <description>Demo project for Spring Boot</description>
  13.    
  14.   <parent>
  15.   <groupId>org.springframework.boot</groupId>
  16.   <artifactId>spring-boot-starter-parent</artifactId>
  17.   <version>1.5.2.RELEASE</version>
  18.    
  19.   <relativePath/> <!-- lookup parent from repository -->
  20.   </parent>
  21.    
  22.   <properties>
  23.   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  24.   <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  25.   <java.version>1.8</java.version>
  26.   <!--修改thymeleaf版本-->
  27.   <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>
  28.   <thymeleaf-layout-dialect.version>2.1.0</thymeleaf-layout-dialect.version>
  29.   </properties>
  30.    
  31.   <dependencies>
  32.   <dependency>
  33.   <groupId>org.springframework.boot</groupId>
  34.   <artifactId>spring-boot-starter-thymeleaf</artifactId>
  35.   </dependency>
  36.   <dependency>
  37.   <groupId>org.springframework.boot</groupId>
  38.   <artifactId>spring-boot-starter-web</artifactId>
  39.   </dependency>
  40.    
  41.   <dependency>
  42.   <groupId>org.springframework.boot</groupId>
  43.   <artifactId>spring-boot-starter-test</artifactId>
  44.   <scope>test</scope>
  45.   </dependency>
  46.   </dependencies>
  47.    
  48.   <build>
  49.   <plugins>
  50.   <plugin>
  51.   <groupId>org.springframework.boot</groupId>
  52.   <artifactId>spring-boot-maven-plugin</artifactId>
  53.   </plugin>
  54.   </plugins>
  55.   </build>
  56.    
  57.    
  58.   </project>

2.从官网下载源代码并解压至项目,注意config.json我拷到了resources根路径下,如图:

 

 

很详细的SpringBoot整合UEditor教程 随笔 第2张

3.添加UEditorController,跳转到index页面:

 

  1.   package com.example;
  2.    
  3.   import org.springframework.stereotype.Controller;
  4.   import org.springframework.web.bind.annotation.RequestMapping;
  5.    
  6.   /**
  7.   * Created by ldb on 2017/4/9.
  8.   */
  9.   @Controller
  10.   public class UEditorController {
  11.    
  12.    
  13.   @RequestMapping("/")
  14.   private String showPage(){
  15.   return "index";
  16.   }
  17.    
  18.    
  19.   }

4.运行项目。访问路径localhost:8080,跳转到如下界面即是源码已拷贝成功

 

很详细的SpringBoot整合UEditor教程 随笔 第3张

5.此时发现上传图片功能不能用。下面接着看。修改pom,添加UEditor依赖的Jar包。pom文件如下: 

  1.   <?xml version="1.0" encoding="UTF-8"?>
  2.   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4.   <modelVersion>4.0.0</modelVersion>
  5.    
  6.   <groupId>com.example</groupId>
  7.   <artifactId>ueditor</artifactId>
  8.   <version>0.0.1-SNAPSHOT</version>
  9.   <packaging>jar</packaging>
  10.    
  11.   <name>ueditor</name>
  12.   <description>Demo project for Spring Boot</description>
  13.    
  14.   <parent>
  15.   <groupId>org.springframework.boot</groupId>
  16.   <artifactId>spring-boot-starter-parent</artifactId>
  17.   <version>1.5.2.RELEASE</version>
  18.   <relativePath/> <!-- lookup parent from repository -->
  19.   </parent>
  20.    
  21.   <properties>
  22.   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  23.   <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  24.   <java.version>1.8</java.version>
  25.   <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>
  26.   <thymeleaf-layout-dialect.version>2.1.0</thymeleaf-layout-dialect.version>
  27.   </properties>
  28.    
  29.   <dependencies>
  30.   <dependency>
  31.   <groupId>org.springframework.boot</groupId>
  32.   <artifactId>spring-boot-starter-thymeleaf</artifactId>
  33.   </dependency>
  34.   <dependency>
  35.   <groupId>org.springframework.boot</groupId>
  36.   <artifactId>spring-boot-starter-web</artifactId>
  37.   </dependency>
  38.    
  39.   <dependency>
  40.   <groupId>org.springframework.boot</groupId>
  41.   <artifactId>spring-boot-starter-test</artifactId>
  42.   <scope>test</scope>
  43.   </dependency>
  44.    
  45.   <!--UEditor依赖的jar包 -->
  46.   <dependency>
  47.   <groupId>org.json</groupId>
  48.   <artifactId>json</artifactId>
  49.   </dependency>
  50.   <dependency>
  51.   <groupId>commons-fileupload</groupId>
  52.   <artifactId>commons-fileupload</artifactId>
  53.   <version>1.3.2</version>
  54.   </dependency>
  55.   <dependency>
  56.   <groupId>commons-codec</groupId>
  57.   <artifactId>commons-codec</artifactId>
  58.   <version>1.9</version>
  59.   </dependency>
  60.   </dependencies>
  61.    
  62.   <build>
  63.   <plugins>
  64.   <plugin>
  65.   <groupId>org.springframework.boot</groupId>
  66.   <artifactId>spring-boot-maven-plugin</artifactId>
  67.   </plugin>
  68.   </plugins>
  69.   </build>
  70.    
  71.    
  72.   </project>
6.照着源码里的controller.jsp.依样画葫芦,写入UEditorController类,映射路径为config。
  1.   package com.example;
  2.    
  3.   import com.baidu.ueditor.ActionEnter;
  4.   import org.springframework.stereotype.Controller;
  5.   import org.springframework.web.bind.annotation.RequestMapping;
  6.    
  7.   import javax.servlet.http.HttpServletRequest;
  8.   import javax.servlet.http.HttpServletResponse;
  9.   import java.io.IOException;
  10.   import java.io.PrintWriter;
  11.    
  12.   /**
  13.   * Created by ldb on 2017/4/9.
  14.   */
  15.   @Controller
  16.   public class UEditorController {
  17.    
  18.    
  19.   @RequestMapping("/")
  20.   private String showPage(){
  21.   return "index";
  22.   }
  23.    
  24.   @RequestMapping(value="/config")
  25.   public void config(HttpServletRequest request, HttpServletResponse response) {
  26.   response.setContentType( "application/json");
  27.   String rootPath = request.getSession().getServletContext().getRealPath( "/");
  28.   try {
  29.   String exec = new ActionEnter(request, rootPath).exec();
  30.   PrintWriter writer = response.getWriter();
  31.   writer.write(exec);
  32.   writer.flush();
  33.   writer.close();
  34.   } catch (IOException e) {
  35.   e.printStackTrace();
  36.   }
  37.    
  38.   }
  39.   }
7.一步一步debug,发现无法加载config.json文件。此时修改ConfigManage类的getConfigPath()方法。如下:

 

  1.   package com.baidu.ueditor;
  2.    
  3.   import com.baidu.ueditor.define.ActionMap;
  4.   import org.json.JSONArray;
  5.   import org.json.JSONObject;
  6.    
  7.   import java.io.*;
  8.   import java.net.URISyntaxException;
  9.   import java.util.HashMap;
  10.   import java.util.Map;
  11.    
  12.   /**
  13.   * 配置管理器
  14.   * @author hancong03@baidu.com
  15.   *
  16.   */
  17.   public final class ConfigManager {
  18.    
  19.   private final String rootPath;
  20.   private final String originalPath;
  21.   private final String contextPath;
  22.   private static final String configFileName = "config.json";
  23.   private String parentPath = null;
  24.   private JSONObject jsonConfig = null;
  25.   // 涂鸦上传filename定义
  26.   private final static String SCRAWL_FILE_NAME = "scrawl";
  27.   // 远程图片抓取filename定义
  28.   private final static String REMOTE_FILE_NAME = "remote";
  29.    
  30.   /*
  31.   * 通过一个给定的路径构建一个配置管理器, 该管理器要求地址路径所在目录下必须存在config.properties文件
  32.   */
  33.   private ConfigManager ( String rootPath, String contextPath, String uri ) throws FileNotFoundException, IOException {
  34.    
  35.   rootPath = rootPath.replace( "\\", "/" );
  36.    
  37.   this.rootPath = rootPath;
  38.   this.contextPath = contextPath;
  39.    
  40.   if ( contextPath.length() > 0 ) {
  41.   this.originalPath = this.rootPath + uri.substring( contextPath.length() );
  42.   } else {
  43.   this.originalPath = this.rootPath + uri;
  44.   }
  45.    
  46.   this.initEnv();
  47.    
  48.   }
  49.    
  50.   /**
  51.   * 配置管理器构造工厂
  52.   * @param rootPath 服务器根路径
  53.   * @param contextPath 服务器所在项目路径
  54.   * @param uri 当前访问的uri
  55.   * @return 配置管理器实例或者null
  56.   */
  57.   public static ConfigManager getInstance ( String rootPath, String contextPath, String uri ) {
  58.    
  59.   try {
  60.   return new ConfigManager(rootPath, contextPath, uri);
  61.   } catch ( Exception e ) {
  62.   return null;
  63.   }
  64.    
  65.   }
  66.    
  67.   // 验证配置文件加载是否正确
  68.   public boolean valid () {
  69.   return this.jsonConfig != null;
  70.   }
  71.    
  72.   public JSONObject getAllConfig () {
  73.    
  74.   return this.jsonConfig;
  75.    
  76.   }
  77.    
  78.   public Map<String, Object> getConfig ( int type ) {
  79.    
  80.   Map<String, Object> conf = new HashMap<String, Object>();
  81.   String savePath = null;
  82.    
  83.   switch ( type ) {
  84.    
  85.   case ActionMap.UPLOAD_FILE:
  86.   conf.put( "isBase64", "false" );
  87.   conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
  88.   conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
  89.   conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
  90.   savePath = this.jsonConfig.getString( "filePathFormat" );
  91.   break;
  92.    
  93.   case ActionMap.UPLOAD_IMAGE:
  94.   conf.put( "isBase64", "false" );
  95.   conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
  96.   conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
  97.   conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
  98.   savePath = this.jsonConfig.getString( "imagePathFormat" );
  99.   break;
  100.    
  101.   case ActionMap.UPLOAD_VIDEO:
  102.   conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
  103.   conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
  104.   conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
  105.   savePath = this.jsonConfig.getString( "videoPathFormat" );
  106.   break;
  107.    
  108.   case ActionMap.UPLOAD_SCRAWL:
  109.   conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
  110.   conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
  111.   conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
  112.   conf.put( "isBase64", "true" );
  113.   savePath = this.jsonConfig.getString( "scrawlPathFormat" );
  114.   break;
  115.    
  116.   case ActionMap.CATCH_IMAGE:
  117.   conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
  118.   conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
  119.   conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
  120.   conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
  121.   conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
  122.   savePath = this.jsonConfig.getString( "catcherPathFormat" );
  123.   break;
  124.    
  125.   case ActionMap.LIST_IMAGE:
  126.   conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
  127.   conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
  128.   conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
  129.   break;
  130.    
  131.   case ActionMap.LIST_FILE:
  132.   conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
  133.   conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
  134.   conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
  135.   break;
  136.    
  137.   }
  138.    
  139.   conf.put( "savePath", savePath );
  140.   conf.put( "rootPath", this.rootPath );
  141.    
  142.   return conf;
  143.    
  144.   }
  145.    
  146.   private void initEnv () throws FileNotFoundException, IOException {
  147.    
  148.   File file = new File( this.originalPath );
  149.    
  150.   if ( !file.isAbsolute() ) {
  151.   file = new File( file.getAbsolutePath() );
  152.   }
  153.    
  154.   this.parentPath = file.getParent();
  155.    
  156.   String configContent = this.readFile( this.getConfigPath() );
  157.    
  158.   try{
  159.   JSONObject jsonConfig = new JSONObject( configContent );
  160.   this.jsonConfig = jsonConfig;
  161.   } catch ( Exception e ) {
  162.   this.jsonConfig = null;
  163.   }
  164.    
  165.   }
  166.    
  167.    
  168.   private String getConfigPath () {
  169.   //return this.parentPath + File.separator + ConfigManager.configFileName;
  170.   try {
  171.   //获取classpath下的config.json路径
  172.   return this.getClass().getClassLoader().getResource("config.json").toURI().getPath();
  173.   } catch (URISyntaxException e) {
  174.   return null;
  175.   }
  176.   }
  177.    
  178.   private String[] getArray ( String key ) {
  179.    
  180.   JSONArray jsonArray = this.jsonConfig.getJSONArray( key );
  181.   String[] result = new String[ jsonArray.length() ];
  182.    
  183.   for ( int i = 0, len = jsonArray.length(); i < len; i++ ) {
  184.   result[i] = jsonArray.getString( i );
  185.   }
  186.    
  187.   return result;
  188.    
  189.   }
  190.    
  191.   private String readFile ( String path ) throws IOException {
  192.    
  193.   StringBuilder builder = new StringBuilder();
  194.    
  195.   try {
  196.    
  197.   InputStreamReader reader = new InputStreamReader( new FileInputStream( path ), "UTF-8" );
  198.   BufferedReader bfReader = new BufferedReader( reader );
  199.    
  200.   String tmpContent = null;
  201.    
  202.   while ( ( tmpContent = bfReader.readLine() ) != null ) {
  203.   builder.append( tmpContent );
  204.   }
  205.    
  206.   bfReader.close();
  207.    
  208.   } catch ( UnsupportedEncodingException e ) {
  209.   // 忽略
  210.   }
  211.    
  212.   return this.filter( builder.toString() );
  213.    
  214.   }
  215.    
  216.   // 过滤输入字符串, 剔除多行注释以及替换掉反斜杠
  217.   private String filter ( String input ) {
  218.    
  219.   return input.replaceAll( "/\\*[\\s\\S]*?\\*/", "" );
  220.    
  221.   }
  222.    
  223.   }
this.getClass().getClassLoader().getResource("config.json").toURI().getPath(); 
此处需要先转为URI再getPath(),否则如果你的项目路径带空格或者带中文则无法读取到文件

 

8.运行项目路径http://localhost:8080/config?action=config,如下图显示则表示可读取到config.json文件

 

很详细的SpringBoot整合UEditor教程 随笔 第4张很详细的SpringBoot整合UEditor教程 随笔 第5张

9.此时点击上传图片显示 如下

 

很详细的SpringBoot整合UEditor教程 随笔 第6张很详细的SpringBoot整合UEditor教程 随笔 第7张

提示未找到上传数据。继续一步步debug,发现在BinaryUploader类竟然无法获取到字节流

 

很详细的SpringBoot整合UEditor教程 随笔 第8张很详细的SpringBoot整合UEditor教程 随笔 第9张

google得到原因是因为SpringMVC框架对含字节流的request进行了处理,此处传的是处理过的request,故获取不到字节流。此时采用SpringMVC框架的解析器multipartResolver。修改源码如下:

  1.   package com.baidu.ueditor.upload;
  2.    
  3.   import com.baidu.ueditor.PathFormat;
  4.   import com.baidu.ueditor.define.AppInfo;
  5.   import com.baidu.ueditor.define.BaseState;
  6.   import com.baidu.ueditor.define.FileType;
  7.   import com.baidu.ueditor.define.State;
  8.   import org.apache.commons.fileupload.servlet.ServletFileUpload;
  9.   import org.springframework.web.multipart.MultipartFile;
  10.   import org.springframework.web.multipart.MultipartHttpServletRequest;
  11.    
  12.   import javax.servlet.http.HttpServletRequest;
  13.   import java.io.IOException;
  14.   import java.io.InputStream;
  15.   import java.util.Arrays;
  16.   import java.util.List;
  17.   import java.util.Map;
  18.    
  19.   public class BinaryUploader {
  20.    
  21.   public static final State save(HttpServletRequest request,
  22.   Map<String, Object> conf) {
  23.   // FileItemStream fileStream = null;
  24.   // boolean isAjaxUpload = request.getHeader( "X_Requested_With" ) != null;
  25.    
  26.   if (!ServletFileUpload.isMultipartContent(request)) {
  27.   return new BaseState(false, AppInfo.NOT_MULTIPART_CONTENT);
  28.   }
  29.    
  30.   // ServletFileUpload upload = new ServletFileUpload(
  31.   // new DiskFileItemFactory());
  32.   //
  33.   // if ( isAjaxUpload ) {
  34.   // upload.setHeaderEncoding( "UTF-8" );
  35.   // }
  36.    
  37.   try {
  38.   // FileItemIterator iterator = upload.getItemIterator(request);
  39.   //
  40.   // while (iterator.hasNext()) {
  41.   // fileStream = iterator.next();
  42.   //
  43.   // if (!fileStream.isFormField())
  44.   // break;
  45.   // fileStream = null;
  46.   // }
  47.   //
  48.   // if (fileStream == null) {
  49.   // return new BaseState(false, AppInfo.NOTFOUND_UPLOAD_DATA);
  50.   // }
  51.   MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
  52.   MultipartFile multipartFile = multipartRequest.getFile(conf.get( "fieldName").toString());
  53.   if(multipartFile==null){
  54.   return new BaseState(false, AppInfo.NOTFOUND_UPLOAD_DATA);
  55.   }
  56.    
  57.   String savePath = (String) conf.get( "savePath");
  58.   //String originFileName = fileStream.getName();
  59.   String originFileName = multipartFile.getOriginalFilename();
  60.   String suffix = FileType.getSuffixByFilename(originFileName);
  61.    
  62.   originFileName = originFileName.substring( 0,
  63.   originFileName.length() - suffix.length());
  64.   savePath = savePath + suffix;
  65.    
  66.   long maxSize = ((Long) conf.get("maxSize")).longValue();
  67.    
  68.   if (!validType(suffix, (String[]) conf.get("allowFiles"))) {
  69.   return new BaseState(false, AppInfo.NOT_ALLOW_FILE_TYPE);
  70.   }
  71.    
  72.   savePath = PathFormat.parse(savePath, originFileName);
  73.    
  74.   String physicalPath = (String) conf.get( "rootPath") + savePath;
  75.    
  76.   //InputStream is = fileStream.openStream();
  77.   InputStream is = multipartFile.getInputStream();
  78.   State storageState = StorageManager.saveFileByInputStream(is,
  79.   physicalPath, maxSize);
  80.   is.close();
  81.    
  82.   if (storageState.isSuccess()) {
  83.   storageState.putInfo( "url", PathFormat.format(savePath));
  84.   storageState.putInfo( "type", suffix);
  85.   storageState.putInfo( "original", originFileName + suffix);
  86.   }
  87.    
  88.   return storageState;
  89.   // } catch (FileUploadException e) {
  90.   // return new BaseState(false, AppInfo.PARSE_REQUEST_ERROR);
  91.   } catch (IOException e) {
  92.   }
  93.   return new BaseState(false, AppInfo.IO_ERROR);
  94.   }
  95.    
  96.   private static boolean validType(String type, String[] allowTypes) {
  97.   List<String> list = Arrays.asList(allowTypes);
  98.    
  99.   return list.contains(type);
  100.   }
  101.   }

 

此时进行上传图片,已经能够成功上传了。

 

 

很详细的SpringBoot整合UEditor教程 随笔 第10张很详细的SpringBoot整合UEditor教程 随笔 第11张

10.可是图片究竟上传到哪里了呢?继续一步步debug发现,上传到如图路径

 

很详细的SpringBoot整合UEditor教程 随笔 第12张很详细的SpringBoot整合UEditor教程 随笔 第13张

如图路径为tomcat缓存路径,只要重启下tomcat该文件就会被删除。我们需要将其存储到磁盘中。此时修改config.json文件。

 

很详细的SpringBoot整合UEditor教程 随笔 第14张很详细的SpringBoot整合UEditor教程 随笔 第15张

红色箭头为修改处。我需要将文件存储到E:/image/**下,此处我多添加了basePath,是想把视频、音乐等静态资源都存储到E盘。由于添加了basePath,需要修改配置。通过debug来到ConfigManage

 

很详细的SpringBoot整合UEditor教程 随笔 第16张

添加红色箭头代码,将basePath塞进配置文件里。之后继续来到上传文件类BinaryUploader,修改如下代码:

 

很详细的SpringBoot整合UEditor教程 随笔 第17张

运行项目,点击添加图片。打开E盘的image目录,如图,成功上传到E盘对应路径

 

很详细的SpringBoot整合UEditor教程 随笔 第18张

11.打开浏览器,发现页面无法加载图片。如下图:

 

很详细的SpringBoot整合UEditor教程 随笔 第19张

打开浏览器调试器。如图

 

很详细的SpringBoot整合UEditor教程 随笔 第20张

无法获取到图片。这是当然的,因为我们把图片存在E盘了,而spring并没有对E盘目录进行映射。此时我们加入路径映射。打开application.properties文件,添加如下代码

web.upload-path=E:/
spring.mvc.static-path-pattern=/** spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}

此时重新运行项目,点击上传图片,图片已经能够正常显示了。

 

很详细的SpringBoot整合UEditor教程 随笔 第21张

 

12.至此,SpringBoot整合UEditor应该完了吧。别急,SpringBoot主张打包成Jar包运行,我们用Maven来打包运行试试

 

很详细的SpringBoot整合UEditor教程 随笔 第22张

java -jar 

打开项目地址,点击上传图片,发现竟然上传不了了??!!

 

很详细的SpringBoot整合UEditor教程 随笔 第23张

这是怎么回事呢?为什么打成Jar包后就无法上传图片了呢。经过不断的debug和google。。发现了在Jar包里无法以ClassLoader.getResource().getPath()获得的路径读取文件,得用Class类的getResourceAsStream()来读取。具体博文如下:

http://hxraid.iteye.com/blog/483115?page=3#comments

13.那么我们就来修改源码,改成getResourceAsStream读取config.json文件吧。打开ConfigManager类,修改initEnv方法

  1.   private void initEnv () throws FileNotFoundException, IOException {
  2.    
  3.   File file = new File( this.originalPath );
  4.    
  5.   if ( !file.isAbsolute() ) {
  6.   file = new File( file.getAbsolutePath() );
  7.   }
  8.    
  9.   this.parentPath = file.getParent();
  10.    
  11.   //String configContent = this.readFile( this.getConfigPath() );
  12.   String configContent = this.filter(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("config.json")));
  13.    
  14.   try{
  15.   JSONObject jsonConfig = new JSONObject( configContent );
  16.   this.jsonConfig = jsonConfig;
  17.   } catch ( Exception e ) {
  18.   this.jsonConfig = null;
  19.   }
  20.    
  21.   }

14. ok了,再次打包,运行项目

 

很详细的SpringBoot整合UEditor教程 随笔 第24张

 

 

成功了!!!

 

项目源码:https://github.com/llldddbbb/ueditor-test

本次教程到此结束。谢谢大家

很详细的SpringBoot整合UEditor教程 随笔 第25张
  • 很详细的SpringBoot整合UEditor教程 随笔 第26张 木丁一:  "basePath": "H:/", /* 本地文件保存的根路径 */ 这里添加了basePath 配置文件也做了映射 还是无法回显 前端返回的url里 只有imagePathFormat配置的路径 basePath下的路径没有返回 所有图片无法回显 请大神赐教(2周前#23楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第27张 sokumakun:  作者你好,我想问一下那个/config是干什么的,不太懂(1个月前#22楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第28张 jameszxl:  博主,我对E盘目录进行映射后,前台还是不显示!!! http://localhost:8080/image/20180609/1528537113706061410.jpg(10个月前#21楼)查看回复(1) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第29张 baidu_35874918:  很好
    1.    
    2.   File file = new File&#40; this.originalPath &#41;;
    3.    
    (6个月前#20楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第31张 qq_33051469:  多图上传中的在线管理要怎么显示图片?(6个月前#18楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第34张 醤油様:  可以很强大,改源码要去官方下载源码,直接复制到项目里面,不用导入他打的jar包,多图上传里面的在线管理也要相应的改下,不然进去没货~ [/code](8个月前#15楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第36张 lisunai:  楼主 怎么整合到项目 不要另外建项目(9个月前#13楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第37张 qq_36685898:  我给springboot项目里加UEditor富文本编辑器,当我点击上传单图和多图时候,后台不会走UEditorController类下的config方法断点,请问我是哪里配置出错了....我qq1395673277(9个月前#12楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第38张 帅气十足的安哥:  通过一个给定的路径构建一个配置管理器, 该管理器要求地址路径所在目录下必须存在config.properties文件 大佬,这句话是什么意思,我按照你的弄了,管理器好像没起作用,是不是差这个配置文件啊(9个月前#11楼) 0
  • 很详细的SpringBoot整合UEditor教程 随笔 第39张 -白日梦想家-:  博主,有个问题,你这边源码是怎么进行修改的,是新建一个同名类去覆盖吗?(10个月前#10楼) 0
登录 查看 30 条热评

百度富文本编辑器Ueditor 集成springboot(不修改源码)

阅读数 4954

项目中使用到百度的富文本编辑器ueditor,网上也有相关的博客做了比较全面的介绍,只是需要较多时间去一一整理,个人认为这其中的难点主要在于加载ueditor的配置文件config.json,网上的教...博文来自: jfh389987366的博客

SpringBoot中使用UEditor基本配置(图文详解)

阅读数 4499

    最近因工作需要,在自己研究百度的富文本编辑器UEditor,这个过程中也遇到很多问题,这里写一下我的心得和总结,希望帮到需要帮助的人。正文如下:第一步:创建SpringBoot项目  首先我使...博文来自: BigPotR

spring Boot + Ueditor整合

阅读数 8124

前阵子因项目需要,加入富文本编辑器,货比三家还是决定使用度娘旗下的Ueditor,下载下的jsp版本单独在tomcat上运行没什么问题,但在与springboot整合过程中出现了问题,研究了好久看了好...博文来自: 萧枫的博客

springboot+maven+ueditor

阅读数 496

ueditor官网下载jsp版本包解压放在src/main/resources/static目录下将config.json放在src/main/resources目录下修改ueditor.config...博文来自: caibird_li的博客

SpringBoot整合富文本编辑器(UEditor)

阅读数 3229

UEditro是一款比较好用的富文本编辑器,所谓的富文本编辑器就是和服务器交互的数据不是普通的字符串文件,而是一些内容包含比较广的字符串,一般是指的html页面,目前比较好用的是百度的UEditor,...博文来自: sky274548769的博客

SpringBoot 整合 ueditor

05-10 SpringBoot 整合ueditor,包括控制器,及前台页面内容都有。 下载

spring boot整合UEditor,不改源码,真实有效

阅读数 850

 UEditor以前在php项目中使用过,是一款非常强大的富文本编辑器,内部实现了各种上传功能,我们甚至不用写任何代码,只需要在所需的项目中正确引入ueditor即可。最近在学习javaspringb...博文来自: Forever_and_ever的博客

springboot+ueditor

阅读数 1291

首先是springboot的项目到官网下载解压放到一直出现 “ueditor.all.min.js:9后台配置项返回格式出错,上传功能将不能正常使用!”似乎是路径不对,原始配置是无法找到config....博文来自: y_xiaoha的博客

 

SpringBoot整合UEditor教程 - qq_38091831的博客 - CSDN博客

10-17

很详细的SpringBoot整合UEditor教程 04-10 1.4万 UEditor只提供JSP版本的后端...来自: 小宝的博客 spring boot 、springMVC环境集成百度ueditor富文本编辑器,使用...

springboot集成ueditor - liubang159的博客 - CSDN博客

10-23

很详细的SpringBoot整合UEditor教程 04-10 1.4万 UEditor只提供JSP版本的后端...来自: 小宝的博客 百度富文本编辑器Ueditor 集成springboot(不修改源码) 02-...

springboot集成ueditor

09-15 包含springboot集成ueditor文档以及解决ueditor上传图片并插入到文本框中的问题。可以进行批量上传图片。 包含springboot集成ueditor文档以及解决ueditor上传图片 下载

SpringBoot + Spring Security + UEditor整合笔记

阅读数 181

UEditor已经停止维护,最后版本停留在16年,但胜在插件多,所有一直在使用。UEditor的核心控制器是JSP写的,但是SpringBoot抛弃了JSP,导致兼容性出现很大的问题。所以需要将Ued...博文来自: 晒太阳的猫

springboot+maven+ueditor - caibird_li的博客 - CSDN博客

11-21

headers = "Accept=application/json") public String ueditor(@RequestParam("action...很详细的SpringBoot整合UEditor教程 - 小宝的博客 04-10 1.6万 UEditor只...

关于springboot与ueditor的整合。 - sinat_36803510的..._CSDN博客

4-5

很详细的SpringBoot整合UEditor教程 04-10 阅读数 2万+ UEditor只提供JSP版本...博文 来自: 小宝的博客 百度富文本编辑器Ueditor 集成springboot(不修改源码) ...

Ueditor使用方法,手把手教你

阅读数 1万+

富文本编辑器ueditor的使用方法博文来自: 阳水平的博客

SpringBoot接入Ueditor编辑器 - 在下的博客 - CSDN博客

11-16

很多时候我们需要使用到富文本编辑器,这里我就分享一下SpringBoot接入百度的UEditor...很详细的SpringBoot整合UEditor教程- 小宝的博客 04-10 1.6万 UEditor只提供...

springboot整合ueditor 后端篇(简洁版) - xu1204013031的博客 -...

3-29

很详细的SpringBoot整合UEditor教程 04-10 阅读数 2万+ UEditor只提供JSP版本...博文 来自: 小宝的博客 springboot 集成百度编辑器ueditor 07-27 阅读数 2273...

springboot整合ueditor 后端篇(简洁版)

阅读数 668

此文适合前后端分离的ueditor整合springboot,首先要理解ueditor只是个前端的js工具,绝大部分功能都是前端完成。但是但是图片,视频等需要和后端交互的功能就需要稍微配置一下后端,让那...博文来自: xu1204013031的博客

springboot 集成百度编辑器ueditor

阅读数 2707

最简单的方式集成百度编辑器1.下载百度编辑器源码2.springboot静态资源配置在resources下面。将ueditor的静态资源放入项目中如:我的资源路径为:/resources/js/plu...博文来自: 永不止步

spring Boot + Ueditor整合 - 萧枫的博客 - CSDN博客

4-5

很详细的SpringBoot整合UEditor教程 04-10 阅读数 2万+ UEditor只提供JSP版本...博文 来自: 小宝的博客 百度富文本编辑器Ueditor 集成springboot(不修改源码) ...

springboot整合ueditor 前端篇 - xu1204013031的博客 - CSDN博客

10-26

很详细的SpringBoot整合UEditor教程 04-10 1.5万 UEditor只提供JSP版本的后端...来自: 小宝的博客 编辑器ueditor和springboot 的整合 08-21 3443 1.先导入...

晚上白开水+它,胖到160斤都能瘦,后悔没早知道丙申科技 · 猎媒

CentOS SSH安装和配置

阅读数 6486

CentOSSSH安装和配置赞0CentOS SSH 安装 配置 OpenSSHSSH为SecureShell的缩写,由IETF的网络工作小组(NetworkWorkingGroup)所制定;SSH为...博文来自: 耕耘——从菜鸟到高手的蜕变

编辑器ueditor和springboot 的整合 - 白天不懂夜的黑的..._CSDN博客

10-28

很详细的SpringBoot整合UEditor教程 04-10 1.5万 UEditor只提供JSP版本的后端入口...来自: 小宝的博客 spring Boot + Ueditor整合 09-26 6546 前阵子因项目...

项目中用到的2个工具类代码:FTP与SendMail

阅读数 4237

今天刚写了几个代码,用在正在开发的项目中虽然是从各处找来的,但是经过我修改完善了一下1SendMail--用于项目中贺卡的发送 原本来自于aistill原作的代码:http://www.csdn.ne...博文来自: 冰云BLOG

SpringBoot整合UEditor文本编辑器

04-24 修改config.json文件的图片存储路径即可 运行项目.访问路径localhost:8080/ 下载

springboot ueditor 整合篇

阅读数 622

一、上传文件到本地版本    项目地址:https://github.com/weiangongsi/ueditor-spring-boot-starter 文件导入 新建springboot项目 ...博文来自: 李浩洋

编辑器ueditor和springboot 的整合

阅读数 4740

1.先导入ueditor所有的包:在springbootstatic下2.导入需要的ueditor的js3.配置ueditor.config.js的//服务器统一请求接口路径://,serverUrl...博文来自: 白天不懂夜的黑的博客

 

SpringBoot接入Ueditor编辑器

阅读数 380

很多时候我们需要使用到富文本编辑器,这里我就分享一下SpringBoot接入百度的UEditor编辑器的方法;下载UEditor编辑器官网:https://ueditor.baidu.com/webs...博文来自: 在下的博客

第三方插件的引用(1) : SSM,springboot 引入ueditor及图片上传阿里云OS和展示

阅读数 226

1.博文来自: Lxinccode的博客

SpringBoot整合ueditor

阅读数 453

SpringBoot整合ueditor教程,不需要更高源码,支持,html或者是集成了jsp两种方式一、使用springboot集成jsp方式1、下载jsp版本的ueditor2、搭建springbo...博文来自: xljx_1的博客

Spring Boot项目百度UEditor上传图片

阅读数 3261

业务背景springboot项目实现富文本框上传图片到富文本框中,可新增、编辑图片保存在独立的FastDFS服务器上开发步骤下载源码UEditor官网下载地址我下载的版本是【1.4.3.3Jsp版本】...博文来自: thebigdipperbdx的博客

关于springboot与ueditor的整合。

阅读数 6338

最近做项目,需要用到ueditor上传图片,之前也用过ueditor,不过当时的使用仅限于字体简单的格式,一直没出过什么问题,虽然每次启动项目会在页面爆出一个问题“后台配置项错误,上传功能不能正常使用...博文来自: sinat_36803510的博客

老中医说:白开水+它,喝完排出“巨便”大肚子也没了!青春美 · 猎媒

vue + Springboot 前后端分离集成UEditor

阅读数 1306

UEditor只提供JSP版本的后端入口代码。但是它提供了项目源码,因此我们可以根据业务需求来修改源代码。现在开始集成UEditor 1、下载UEditor官网最新的jsp版本的包,下载完成解压之后得...博文来自: qq_38960998的博客

springboot thymeleaf ueditor 填坑

阅读数 2114

搞了两小时,累死哥哥了我的项目结构是:springboot+maven+mybatis+thymeleaf ...  呸呸呸,这些都不重要啦下面开始正题说说问题吧: 刚开始我从官网下载的jsp版本的新...博文来自: Lee的程序空间

springboot 集成ueditor

阅读数 5882

1下载ueditor的jsp版本这里不做介绍,自行下载即可2将文件放在ser/main/resources/static中将下载好的文件夹放在3导入ueditor的jar包导入ueditor的jar包...博文来自: jiaHey的博客

Spring Boot整合UEditor,解决找不到上传文件的问题

阅读数 9232

在实践中如果贸然尝试使用Controller会导致上传文件失败,原因是因为SpringBoot的Request不能强转成为MultipartRequest,只能通过注解请求数据的键作为参数才能获得上传...博文来自: 杨若瑜的技术博客

spring boot 、springMVC环境集成百度ueditor富文本编辑器,使用七牛云存储图片

阅读数 9876

基于springboot的项目中要用到富文本编辑器,但百度UEditor的后台代码给出的是jsp版本的实现,由于项目使用的thymeleaf,不愿为了一个插件单独添加jsp支持;且项目中又使用七牛存储...博文来自: zrk1000的专栏

 

腾讯视频的地址解析下载

阅读数 3万+

以腾讯视频播放页地址http://v.qq.com/x/cover/rz4mhb6494f12co.html为例,说说如何解析得到视频的真实地址。提取视频ID在播放页源码中,可以找到如下视频信息:va...博文来自: 飞翔的熊blabla

python图片处理类之~PIL.Image模块(ios android icon图标自动生成处理)

阅读数 6万+

1.从pyCharm提示下载PIL包 http://www.pythonware.com/products/pil/ 2.解压后,进入到目录下cd/Users/jianan/Downloads/Ima...博文来自: 专注于cocos+unity+服务器全栈

关于SpringBoot bean无法注入的问题(与文件包位置有关)

阅读数 18万+

问题场景描述整个项目通过Maven构建,大致结构如下:核心Spring框架一个modulespring-boot-baseservice和dao一个moduleserver-core提供系统后台数据管...博文来自: 开发随笔

Isometric Game 及译法漫谈

阅读数 7702

原文地址:点击打开链接作者按:本文探讨了IsometricGame相关的背景知识。为了避免读者感觉枯燥(除了游戏之外的有些概念确实枯燥),作者尽量采取“用图说话”的方式,文字尽量简短,图解尽量简明。而...博文来自: 图灵教育

MySQL5.6 数据库主从(Master/Slave)同步安装与配置详解

阅读数 14万+

安装环境操作系统:CentOS6.5数据库版本:MySQL5.6.27主机A:192.168.1.1(Master)主机B:192.168.1.2(Slave)这里强调的数据库的版本,是因为MySQL...博文来自: 徐刘根的博客

脱发的元凶竟然是这个!学会这个方法,头发疯长!康纳 · 猎媒

基于springboot+vue+element+ueditor实现前后端分离的富文本框实现

阅读数 6737

springboot+vue+ueditor的整合博文来自: Simle_MiMI的博客

SpringBoot整合UEditor教程

阅读数 362

UEditor只提供JSP版本的后端入口代码。但提供了项目源码,因此可以根据业务需求修改源代码。此处使用了SpringBoot框架,配备了Thymeleaf模板引擎,所以没有必要再添加jsp来兼容UE...博文来自: Yoga0301的博客

springboot整合ueditor源码(自己写,测试可用,不需要修改ueditor源码)

01-12 springboot和ueditor的整合,自己写完测试过可以用,下载下来只需要修改index.html中的地址就可以。具体搭建的步骤在:https://www.jianshu.com/p/006e6 下载

springboot 添加百度的ueditor

阅读数 388

ueditor提示:“后端配置项没有正常加载,上传插件不能正常使用!”,搞了我一天都没有搞好,直到看到这篇帖子,太感谢了!1下载ueditor的jsp版本这里不做介绍,自行下载即可2将文件放在ser/...博文来自: u010261944的博客

连续特征离散化和归一化

阅读数 3万+

连续特征进行离散化处理。博文来自: hero_fantao的专栏

码农必看:各大平台的推荐系统原来是靠它完成的,太牛了

第四范式先荐帮助客户从0到1搭建推荐系统,显著提升用户活跃,留存,观看时长等重要业务指标

很详细的SpringBoot整合UEditor教程 随笔 第41张

非局部均值去噪(NL-means)

阅读数 1万+

非局部均值(NL-means)是近年来提出的一项新型的去噪技术。该方法充分利用了图像中的冗余信息,在去噪的同时能最大程度地保持图像的细节特征。基本思想是:当前像素的估计值由图像中与它具有相似邻域结构的...博文来自: xiaoluo91的专栏

Spring Boot集成百度Ueditor

阅读数 269

转自:https://www.cnblogs.com/liter7/p/7745606.html在此感谢遇到的问题:  1.将ueditor加入/static目录下,能正常显示,但是出现“请求后台配置...博文来自: ----------

springboot + thymeleaf + mybatis + ueditor

阅读数 991

前面讲了简单的ueditor搭建,今天记录一下上传和图片空间的开发:由于springboot不好放图片,放上去也会让后面我的打的包越来越大,这不科学,所以用项目外的图片服务器,这路我用的七牛云,当然也...博文来自: Lee的程序空间

vue2+ueditor+springboot

阅读数 1377

本文主要阐述的是vue2+ueditor+springboot的整合。此处记录下碰到的坑:在使用springboot中font-awesome的处理 org.apache.maven.pluginsm...博文来自: 青年可的博客

spring boot 整合ueditor的问题

11-22

如题,spring boot 整合ueditor进行图片上传,搞了半天,唯一的收获就是能打开前端的jsp页面,然后把图片上传,但是因为需要把图片的信息存到mysql中,所以后台controller需要论坛

如何快速提升个性化推荐效果?

先荐推荐系统适合首页,信息流,内容详情页等场景,支持网页, APP,小程序,快应用,1分钟安装5分钟上线,支持人工干预推荐

很详细的SpringBoot整合UEditor教程 随笔 第42张

spring boot 集成ueditor

阅读数 142

1,将配置文件的获取方式修改成,由sprongmvc controller 中返回2,在使用到ueditor 的地址加入上传请求的拦截,并将上传地址返回给ueditor 配置中心3,自定义上传接口由于...博文来自: gu_zhang_w的博客

Ueditor 集成SpringBoot 打成jar包放到服务器出现的问题

阅读数 748

打成jar百度的富文本就会出现这个问题本地环境不会,上了测试机就会,是读取不到后台配置信息造成的controller.jsp这个文件读取不到项目的真实路径,遇到同样问题的人可以打下log看下所以这种情...博文来自: 走过程序员的路

springboot集成Ueditor(踩坑)

阅读数 187

本人只是将平时的笔记心得与大家分享一下项目需要用到富文本,本人选择百度的Ueditor,虽然功能很强大,但坑非常多,我们来慢慢踩。1、下载ueditorjsputf-8我这里给出,我下载的地址http...博文来自: qq_41603102的博客

SpringBoot 配置富文本编辑器 xheditor

阅读数 3720

一年前写过一篇:struts2配置xheditor的文章。那时候还在用ssh,现在开始用springboot。本来想配置CSDN的markdown编辑器的,可惜在github上找不到。所以,还是用回轻...博文来自: 小浩子的博客

Spring Boot+Thymeleaf+UEditor 图文上传

阅读数 1180

在APP中,介绍类文章都是图文混排形式展示。本文分享SpringBoot+Thymeleaf+ UEditor图文上传。第一步:下载并配置UEditor 1、UEditor下载地址:http://ue...博文来自: YLJ2012127的博客

第四范式发布先荐推荐系统,帮助300+媒体平台实现内容升级

先荐推荐系统由国际顶尖智能推荐团队研发,三步即可完成接入,毫秒级数据更新,支持PC,WAP, APP全平台接入

很详细的SpringBoot整合UEditor教程 随笔 第43张

Spring Boot + thymeleaf + UEditor整合

阅读数 789

因为公司项目需求,需要使用富文本编辑器,货比三家选择了百度的UEditor。然而做这个时,我这个小萌新连SpringBoot都不太清楚,所以给自己挖了很多坑,然后一直在填坑.....首先到官网下载源码...博文来自: Rude_M的博客

SpringBoot 加入Ueditor

阅读数 207

官方提供的只有jsp版本.....emmmmmm......................又有那么多功能不想自己重写....好在有一堆java文件...那好办了......首先创建一个Ueditor...博文来自: lilinrui_ruirui的博客

编写C语言版本的卷积神经网络CNN之一:前言与Minst数据集

阅读数 2万+

卷积神经网络是深度学习的基础,但是学习CNN却不是那么简单,虽然网络上关于CNN的相关代码很多,比较经典的是tiny_cnn(C++)、DeepLearnToolbox(Matlab)等等,但通过C语...博文来自: tostq的专栏

ODAC (odp.net) 从开发到部署

阅读数 1万+

test博文来自: 我想我是海 冬天的大海 心情随风轻摆

【深度剖析HMM(附Python代码)】1.前言及隐马尔科夫链HMM的背景

阅读数 1万+

1. 前言 隐马尔科夫HMM模型是一类重要的机器学习方法,其主要用于序列数据的分析,广泛应用于语音识别、文本翻译、序列预测、中文分词等多个领域。虽然近年来,由于RNN等深度学习方法的发展,HMM模型...博文来自: tostq的专栏

Alibaba-AndFix Bug热修复框架原理及源码解析

阅读数 4万+

小憩之后,继续为你解读AndFix热修复框架,呵呵。上一篇Alibaba-AndFix Bug热修复框架的使用已经介绍了AndFix的使用,这篇主要介绍AndFix原理以及源码解析。AndFix原理A...博文来自: 我是乔同学

如何在ArcGIS Online中构建自己的应用程序模板初级篇-显示地图

阅读数 4万+

开发ArcGIS Online应用程序模板之前,需要了解怎么使用ArcGIS API for JavaScript。     在ArcGIS Online当中如何构架自己的应用程序模板,我们得先要了...博文来自: ArcGIS产品与技术专栏

DirectX修复工具增强版

阅读数 192万+

最后更新:2018-12-20 DirectX修复工具最新版:DirectX Repair V3.8 增强版  NEW! 版本号:V3.8.0.11638 大小: 107MB/7z格式压缩,18...博文来自: VBcom的专栏

彻底解决MFC/C#中在控件上播放opencv的Mat类型帧视频-亲测满足实时性要求

阅读数 1237

做MFC+opencv项目时,对于我来说,将视频显示到相应控件上(static或者picture)这个问题一直存在,虽然之前写个一个帖子,介绍了一种将opencv的显示window贴到相应控件上的方法...博文来自: 沐阳2100的博客

OpenCV+OpenGL 双目立体视觉三维重建

阅读数 4万+

0.绪论这篇文章主要为了研究双目立体视觉的最终目标——三维重建,系统的介绍了三维重建的整体步骤。双目立体视觉的整体流程包括:图像获取,摄像机标定,特征提取(稠密匹配中这一步可以省略),立体匹配,三维重...博文来自: shiter编写程序的艺术

【小程序】微信小程序开发实践

阅读数 26万+

帐号相关流程注册范围 企业 政府 媒体 其他组织换句话讲就是不让个人开发者注册。 :)填写企业信息不能使用和之前的公众号账户相同的邮箱,也就是说小程序是和微信公众号一个层级的。填写公司机构信息,对公账...博文来自: 小雨同学的技术博客

【HTTP】Fiddler(一) - Fiddler简介

阅读数 30万+

1.为什么是Fiddler? 抓包工具有很多,小到最常用的web调试工具firebug,达到通用的强大的抓包工具wireshark.为什么使用fiddler?原因如下: a.Firebug虽然可以抓包...博文来自: 专注、专心

centos 查看命令源码

阅读数 9万+

# yum install yum-utils 设置源: [base-src] name=CentOS-5.4 - Base src - baseurl=http://vault.ce...博文来自: linux/unix

Android Multimedia框架总结(二十三)MediaCodec补充及MediaMuxer引入(附案例)

阅读数 7373

前言:前面几章都是分析MediaCodec相关源码,有收到提问,说MediaCodec到底是硬解码还是软解码?看下今天的Agenda: MediaCodec到底是硬解码还是软解码 MediaMuxer...博文来自: 逆流的鱼yuiop

webService学习(二)—— 调用自定义对象参数

阅读数 2万+

webService学习(二)—— 调用自定义对象参数 本文主要内容: 1、如何通过idea进行webService Client的简单实现(不再使用wsimport的方式,其实是ide帮我们做了...博文来自: 止水的专栏

QT选择目录等常用文件/文件夹操作

阅读数 2万+

QT 创建文件夹 bool QDir::mkdir ( const QString &amp; dirName ) const 创建一个子目录名为目录名。[喝小酒的网摘]http://blog....博文来自: K7的专栏

搭建图片服务器《二》-linux安装nginx

阅读数 3万+

nginx是个好东西,Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambl...博文来自: maoyuanming0806的博客

灰度图像的自动阈值分割(Otsu 法)

阅读数 3万+

灰度图像的自动阈值分割(Otsu 法)机器视觉领域许多算法都要求先对图像进行二值化。这种二值化操作阈值的选取非常重要。阈值选取的不合适,可能得到的结果就毫无用处。今天就来讲讲一种自动计算阈值的方法。这...博文来自: Ivan 的专栏

linux上安装Docker(非常简单的安装方法)

阅读数 20万+

最近比较有空,大四出来实习几个月了,作为实习狗的我,被叫去研究Docker了,汗汗! Docker的三大核心概念:镜像、容器、仓库 镜像:类似虚拟机的镜像、用俗话说就是安装文件。 容器:类似一个轻量...博文来自: 我走小路的博客

jquery/js实现一个网页同时调用多个倒计时(最新的)

阅读数 44万+

jquery/js实现一个网页同时调用多个倒计时(最新的) 最近需要网页添加多个倒计时. 查阅网络,基本上都是千遍一律的不好用. 自己按需写了个.希望对大家有用. 有用请赞一个哦! //js ...博文来自: Websites

异常点/离群点检测算法——LOF

阅读数 6万+

局部异常因子算法-Local Outlier Factor(LOF)  在数据挖掘方面,经常需要在做特征工程和模型训练之前对数据进行清洗,剔除无效数据和异常数据。异常检测也是数据挖掘的一个方向,用于反...博文来自: wangyibo0201的博客

强连通分量及缩点tarjan算法解析

阅读数 57万+

强连通分量: 简言之 就是找环(每条边只走一次,两两可达) 孤立的一个点也是一个连通分量   使用tarjan算法 在嵌套的多个环中优先得到最大环( 最小环就是每个孤立点)   定义: int Ti...博文来自: 九野的博客

方向导数与梯度

阅读数 3万+

1. 基本概念     方向导数:是一个数;反映的是f(x,y)在P0点沿方向v的变化率。     偏导数:是多个数(每元有一个);是指多元函数沿坐标轴方向的方向导数,因此二元函数就有两个偏导数。  ...博文来自: MyArrow的专栏

jmeter结果分析(监听器):

阅读数 3667

结果分析(监听器): 1.聚合报告 Aggregate Report 是 JMeter 常用的一个 Listener,中文被翻译为“聚合报告

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄