File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 40
40
* [ Resize] ( #resize )
41
41
* [ WaterMark] ( #watermark )
42
42
* [ Compress] ( #compress )
43
- * [ Get Image Size] ( #get-image-size )
43
+ * [ Get External Image Size] ( #get-external-image-size )
44
+ * [ Get Uploaded Image Size] ( #get-uploaded-image-size )
44
45
* [ Get Mime Type] ( #get-mime-type )
45
46
* [ Not Empty] ( #not-empty )
46
47
* [ Is Empty] ( #is-empty )
@@ -540,7 +541,7 @@ File::name('avatar')
540
541
});
541
542
```
542
543
543
- ### Get Image Size
544
+ ### Get External Image Size
544
545
- Takes one param as ` string `
545
546
- Return an ` array ` \| ` null `
546
547
@@ -553,6 +554,19 @@ File::getImageSize('full_source_path')
553
554
]
554
555
```
555
556
557
+ ### Get Uploaded Image Size
558
+ - Takes one param as ` string `
559
+ - Return an ` array ` \| ` null `
560
+
561
+ ```
562
+ File::imageSize('name_of_uploaded_file')
563
+
564
+ [
565
+ ["height"] => int(4209)
566
+ ["width"] => int(3368)
567
+ ]
568
+ ```
569
+
556
570
### Get Mime Type
557
571
- Takes one param as ` string `
558
572
- Return ` string ` \| ` bool ` . ` false ` on error.
Original file line number Diff line number Diff line change @@ -137,6 +137,31 @@ public function filter(...$filter)
137
137
138
138
return $ this ;
139
139
}
140
+
141
+ /**
142
+ * Uploaded Image Size
143
+ *
144
+ * @param mixed $name
145
+ *
146
+ * @return array
147
+ * [width, height]
148
+ */
149
+ public function imageSize (string $ name = null )
150
+ {
151
+ $ instance = $ this ->name ($ name );
152
+
153
+ // loop through to get temporary uploaded file data
154
+ if (!empty ($ instance ->files [$ name ]) && is_array ($ instance ->files [$ name ])){
155
+ foreach ($ instance ->files [$ name ] as $ item ){
156
+ return $ item ->imageSize ();
157
+ }
158
+ }
159
+
160
+ return [
161
+ 'width ' => null ,
162
+ 'height ' => null
163
+ ];
164
+ }
140
165
141
166
/**
142
167
* Get Image Attributes
You can’t perform that action at this time.
0 commit comments