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();
375375| Method | Arguments | Return | Description |
376376| -------------- | ------------------------------ | :------------: | ------------------------------------------------------ |
377377| 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 |
378380| getName | | string or null | Get attachment name |
379381| getType | | string or null | Get attachment type |
380382| getDisposition | | string or null | Get attachment disposition |
Original file line number Diff line number Diff line change 1212
1313namespace Webklex \IMAP ;
1414use Illuminate \Support \Facades \File ;
15+ use Symfony \Component \HttpFoundation \File \MimeType \ExtensionGuesser ;
1516
1617/**
1718 * Class Attachment
@@ -233,4 +234,18 @@ public function getDisposition() {
233234 public function getImgSrc () {
234235 return $ this ->img_src ;
235236 }
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+ }
236251}
You can’t perform that action at this time.
0 commit comments