Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
51bfb1cd
Commit
51bfb1cd
authored
Feb 23, 2021
by
罗承锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整图片路径
parent
3288ad21
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
apply-net/src/main/java/com/winsun/controller/ImgController.java
+6
-1
common/src/main/java/com/winsun/utils/PicturesUtil.java
+6
-1
No files found.
apply-net/src/main/java/com/winsun/controller/ImgController.java
View file @
51bfb1cd
...
@@ -20,12 +20,17 @@ import java.io.IOException;
...
@@ -20,12 +20,17 @@ import java.io.IOException;
@RestController
@RestController
public
class
ImgController
{
public
class
ImgController
{
/**
* 服务器访问路径
*/
private
static
String
pathPre
=
"/springboot/school_center/manager/"
;
//menuname = "图片路径" 只支持jpeg 和 png
//menuname = "图片路径" 只支持jpeg 和 png
@RequestMapping
(
value
=
"/images/**"
,
produces
={
MediaType
.
IMAGE_JPEG_VALUE
,
MediaType
.
IMAGE_PNG_VALUE
}
)
@RequestMapping
(
value
=
"/images/**"
,
produces
={
MediaType
.
IMAGE_JPEG_VALUE
,
MediaType
.
IMAGE_PNG_VALUE
}
)
public
byte
[]
getbackground
(
HttpServletRequest
request
)
{
public
byte
[]
getbackground
(
HttpServletRequest
request
)
{
byte
[]
bytes
=
new
byte
[
10
];
byte
[]
bytes
=
new
byte
[
10
];
request
.
getServletPath
();
request
.
getServletPath
();
String
imgurl
=
FilePath
.
BACKGROUNDIMG
.
getValue
()+
"/"
+
request
.
getServletPath
();
String
imgurl
=
pathPre
+
FilePath
.
BACKGROUNDIMG
.
getValue
()+
"/"
+
request
.
getServletPath
();
imgurl
=
imgurl
.
replace
(
"//"
,
"/"
);
imgurl
=
imgurl
.
replace
(
"//"
,
"/"
);
File
file
=
new
File
(
imgurl
);
File
file
=
new
File
(
imgurl
);
FileInputStream
inputStream
=
null
;
FileInputStream
inputStream
=
null
;
...
...
common/src/main/java/com/winsun/utils/PicturesUtil.java
View file @
51bfb1cd
...
@@ -20,6 +20,11 @@ import java.util.Date;
...
@@ -20,6 +20,11 @@ import java.util.Date;
public
class
PicturesUtil
{
public
class
PicturesUtil
{
/**
/**
* 上传路径
*/
private
static
String
UPLOAD_PRE
=
"/springboot/school_center/manager/"
;
/**
* 上传图片
* 上传图片
* <p>
* <p>
* 前端传来图片必须为jpeg格式
* 前端传来图片必须为jpeg格式
...
@@ -55,7 +60,7 @@ public class PicturesUtil {
...
@@ -55,7 +60,7 @@ public class PicturesUtil {
if
(!
dir
.
exists
())
{
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
dir
.
mkdirs
();
}
//enclosure/images/idCard/temp/年/月/日/name.jpeg
}
//enclosure/images/idCard/temp/年/月/日/name.jpeg
filePath
=
FilePath
.
PATH
.
getValue
()+
pathType
+
"/"
+
yymmdd
+
"/"
+
orderNum
+
"/"
+
(
new
Date
()).
getTime
()
+
"."
+
PicturesUtil
.
checkSuffix
(
houzhui
);
filePath
=
UPLOAD_PRE
+
FilePath
.
PATH
.
getValue
()+
pathType
+
"/"
+
yymmdd
+
"/"
+
orderNum
+
"/"
+
(
new
Date
()).
getTime
()
+
"."
+
PicturesUtil
.
checkSuffix
(
houzhui
);
//byte[] bytes = Base64.getUrlDecoder().decode(base64Data);
//byte[] bytes = Base64.getUrlDecoder().decode(base64Data);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment