Git Product home page Git Product logo

spring-boot-mvc-ueditor-qiniu's Introduction

spring-boot-mvc-ueditor-qiniu

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

依赖库版本:

  • spring boot :1.5.3.RELEASE
  • qiniu-sdk : [7.2.0, 7.2.99]
  • 基于ueditor 1.4.3.3版本源码修改

此版本更新说明:

  • 将spring-boot-mvc-ueditor-qiniu源码与demo放入同一个maven项目中
  • 更新了spring boot版本,七牛sdk版本
  • 增加了ueditor.zone属性,可配置七牛服务器区域Zone

源码:https://github.com/zrk1000/spring-boot-mvc-ueditor-qiniu
博客:http://blog.csdn.net/zrk1000/article/details/53283964

在spring boot环境中,只需引入jar,配置文件中添加config.json配置及七牛相关配置即可使用。

##使用:

1、引入jar (源码在github,请自行编译后再引入):

<!--注意:此版本与上个版本maven坐标不同,-->
<dependency>
    <groupId>com.zrk1000</groupId>
    <artifactId>spring-boot-mvc-ueditor-qiniu</artifactId>
    <version>ueditor1.4.3.3-qiniu7.2.X</version>
</dependency>

2、spring boot启动类添加扫描: @ComponentScan(basePackages = {“com.baidu”}):

@Controller
@ComponentScan(basePackages = {"com.zrk","com.baidu"})
@SpringBootApplication
public class SpringBootMvcUeditorQiniuDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootMvcUeditorQiniuDemoApplication.class, args);
    }

    @RequestMapping("/")
    public String index(){
        return "ueditor";
    }

}

3、application.properties中添加ueditor的config.json配置,和七牛相关配置:

spring.thymeleaf.enabled=true

spring.http.multipart.max-file-size=500MB
spring.http.multipart.max-request-size=20MB

ueditor.config={"imageActionName":"uploadimage","imageFieldName":"upfile","imageMaxSize":2048000,"imageAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"imageCompressEnable":true,"imageCompressBorder":1600,"imageInsertAlign":"none","imageUrlPrefix":"","imagePathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","scrawlActionName":"uploadscrawl","scrawlFieldName":"upfile","scrawlPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","scrawlMaxSize":2048000,"scrawlUrlPrefix":"","scrawlInsertAlign":"none","snapscreenActionName":"uploadimage","snapscreenPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","snapscreenUrlPrefix":"","snapscreenInsertAlign":"none","catcherLocalDomain":["127.0.0.1","localhost","img.baidu.com"],"catcherActionName":"catchimage","catcherFieldName":"source","catcherPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","catcherUrlPrefix":"","catcherMaxSize":2048000,"catcherAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"videoActionName":"uploadvideo","videoFieldName":"upfile","videoPathFormat":"/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}","videoUrlPrefix":"","videoMaxSize":102400000,"videoAllowFiles":[".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid"],"fileActionName":"uploadfile","fileFieldName":"upfile","filePathFormat":"/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}","fileUrlPrefix":"","fileMaxSize":51200000,"fileAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp",".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid",".rar",".zip",".tar",".gz",".7z",".bz2",".cab",".iso",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".txt",".md",".xml"],"imageManagerActionName":"listimage","imageManagerListPath":"/ueditor/jsp/upload/image/","imageManagerListSize":20,"imageManagerUrlPrefix":"","imageManagerInsertAlign":"none","imageManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"fileManagerActionName":"listfile","fileManagerListPath":"/ueditor/jsp/upload/file/","fileManagerUrlPrefix":"","fileManagerListSize":20,"fileManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp",".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid",".rar",".zip",".tar",".gz",".7z",".bz2",".cab",".iso",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".txt",".md",".xml"]}
ueditor.access-key=8nU0zA9aTvfHBZs0fPZZWd8gpnFRtOkOPkiTB6M0
ueditor.secret-key=400iGAeaeJyjgSm26-wT8R-HQYZbBR1el_cDiRIq
#七牛机房  华东:zone0 华北:zone1 华南:zone2 北美:zoneNa0
# ueditor.zone也可不配置,会自动识别区域
ueditor.zone=zone0
#zrk-test 华东 (请改为自己七牛bucket及域名,否则图片无法查看和上传)
ueditor.bucket=zrk-test
ueditor.base-url=http://od710rrnd.bkt.clouddn.com
#zrk-test-huabei 华北
#ueditor.bucket=zrk-test-huabei
#ueditor.base-url=http://ordwj6hok.bkt.clouddn.com
ueditor.upload-dir-prefix=biz/img/

spring-boot-mvc-ueditor-qiniu's People

Contributors

zrk1000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

spring-boot-mvc-ueditor-qiniu's Issues

旧的swagger2文档被ueditor覆盖了,只显示ueditor的接口文档了,其他的都丢失了

@SpringBootApplication
@ComponentScan(basePackages = {"com.zrk","com.baidu"})
@EnableSwagger2
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }


    @RequestMapping("/")
    public String index(){
        return "ueditor";
    }
}

旧的swagger2文档被ueditor覆盖了,只显示ueditor的接口文档了,其他的都丢失了,要怎么解决?

关于将源码和demo整合

我将您的源码和demo整合在一起成功了,但是我有个疑问,那就是如何把application中的那个controller移到controller.java中,使得application中只剩下

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }   

这一个函数呢?spring初学者,希望作者能帮帮忙,解解惑。

关于使用ueditor 工具遇到的一些问题

@zrk1000 最近在使用这个插件,发现替换自己的七牛账号,遇到了相关的问题,替换我自己的七牛账号遇到了上传,io错误 具体看了一下代码,发现 :error:incorrect zone, please use up-z1.qiniu.com
区域不支持,最后在尝试换区重新创建解决此问题,使用本插件必须使用 七牛的 华东区 !-_-相当吐血,是否可以考虑支持一下新版本的七牛sdk ?

快来看我。。。

Run AS 启动可以上传图片,为啥部署到tomcat就不行了?404找不到路径。。。

前后端分离, 前端的ueditor上传到后端的ueditor api, 上传提示 不能跨域要怎么解决? No 'Access-Control-Allow-Origin'

上传图片的时候提示这个

XMLHttpRequest cannot load http://172.30.1.XXX:8011/ueditor/upload?action=uploadimage&encode=utf-8. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.