File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ $oFolder = $aMessage->getContainingFolder();
375
375
| Method | Arguments | Return | Description |
376
376
| -------------- | ------------------------------ | :------------: | ------------------------------------------------------ |
377
377
| getContent | | string or null | Get attachment content |
378
+ | getMimeType | | string or null | Get attachment mime type |
379
+ | getExtension | | string or null | Get a guessed attachment extension |
378
380
| getName | | string or null | Get attachment name |
379
381
| getType | | string or null | Get attachment type |
380
382
| getDisposition | | string or null | Get attachment disposition |
Original file line number Diff line number Diff line change 12
12
13
13
namespace Webklex \IMAP ;
14
14
use Illuminate \Support \Facades \File ;
15
+ use Symfony \Component \HttpFoundation \File \MimeType \ExtensionGuesser ;
15
16
16
17
/**
17
18
* Class Attachment
@@ -233,4 +234,18 @@ public function getDisposition() {
233
234
public function getImgSrc () {
234
235
return $ this ->img_src ;
235
236
}
237
+
238
+ /**
239
+ * @return string|null
240
+ */
241
+ public function getMimeType (){
242
+ return (new \finfo ())->buffer ($ this ->getContent (), FILEINFO_MIME_TYPE );
243
+ }
244
+
245
+ /**
246
+ * @return string|null
247
+ */
248
+ public function getExtension (){
249
+ return ExtensionGuesser::getInstance ()->guess ($ this ->getMimeType ());
250
+ }
236
251
}
You can’t perform that action at this time.
0 commit comments