leangem 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fileupload.rb +11 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaa32b8934c9f030d887fb8273c58b86ecbdced2
|
4
|
+
data.tar.gz: e5cb975191834c6cc8ce75543af3e1a8924936e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43d3e8541240115be85bac04eefb4b20678b08935b5cb2414a6591388647d897d707e979c087bd981f451dcbec99b7dc84e2d5da65f43b4e18e084b9b51851a8
|
7
|
+
data.tar.gz: 939d2ce0b3a02a490be6b8cc18305aa8fede9cc383420c6bd3c4dc60360e642d20e0fe8d87daac6599d90688608a8645f281ba95cf9830beff9e54cca23db86b
|
data/lib/fileupload.rb
CHANGED
@@ -11,7 +11,7 @@ class Fileupload
|
|
11
11
|
unless system("mkdir -p #{filepath}")
|
12
12
|
return {state: false, result: "目录创建失败,请于管理员联系"}
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
15
15
|
File.open(filepath+sname, "wb") do |f|
|
16
16
|
f.write(file.read)
|
17
17
|
end
|
@@ -78,12 +78,12 @@ class Fileupload
|
|
78
78
|
unless system("mkdir -p #{filepath}")
|
79
79
|
return {state: false, result: "目录创建失败,请于管理员联系"}
|
80
80
|
end
|
81
|
-
end
|
81
|
+
end
|
82
82
|
File.open(filepath+sname, "wb") do |f|
|
83
83
|
f.write(imgfile.read)
|
84
84
|
end
|
85
|
-
|
86
|
-
|
85
|
+
Fileupload.resize(filepath + sname, w, h)
|
86
|
+
return {state: true, result: sname}
|
87
87
|
rescue
|
88
88
|
return {state: false, result: "写入图片失败:#{$!}"}
|
89
89
|
end
|
@@ -92,6 +92,13 @@ class Fileupload
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
#delete dir
|
96
|
+
#params: dir-> dir path
|
97
|
+
#return true or false
|
98
|
+
def Fileupload.rmdir(dir)
|
99
|
+
system("rm -rf #{dir}")
|
100
|
+
end
|
101
|
+
|
95
102
|
#image resize
|
96
103
|
#params: imagepath-> image file path; w-> new image width; h-> new image height
|
97
104
|
def Fileupload.resize(imagepath, w, h)
|