Skip to content

Commit a48a9ce

Browse files
committed
Attachment size handling added #276
1 parent 0f93655 commit a48a9ce

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ if you're just wishing a feature ;)
743743
| getMimeType | | string or null | Get attachment mime type |
744744
| getExtension | | string or null | Get a guessed attachment extension |
745745
| getName | | string or null | Get attachment name |
746+
| setSize | | int or null | Get attachment size |
746747
| getType | | string or null | Get attachment type |
747748
| getDisposition | | string or null | Get attachment disposition |
748749
| getContentType | | string or null | Get attachment content type |

src/IMAP/Attachment.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* @package Webklex\IMAP
2626
*
2727
* @property integer part_number
28+
* @property integer size
2829
* @property string content
2930
* @property string type
3031
* @property string content_type
@@ -43,6 +44,8 @@
4344
* @method string setContentType(string $content_type)
4445
* @method string getId()
4546
* @method string setId(string $id)
47+
* @method string getSize()
48+
* @method string setSize(integer $size)
4649
* @method string getName()
4750
* @method string getDisposition()
4851
* @method string setDisposition(string $disposition)
@@ -69,6 +72,7 @@ class Attachment {
6972
'name' => null,
7073
'disposition' => null,
7174
'img_src' => null,
75+
'size' => null,
7276
];
7377

7478
/**
@@ -206,6 +210,10 @@ protected function fetch() {
206210
$this->id = str_replace(['<', '>'], '', $this->structure->id);
207211
}
208212

213+
if (property_exists($this->structure, 'bytes')) {
214+
$this->size = $this->structure->bytes;
215+
}
216+
209217
if (property_exists($this->structure, 'dparameters')) {
210218
foreach ($this->structure->dparameters as $parameter) {
211219
if (strtolower($parameter->attribute) == "filename") {

0 commit comments

Comments
 (0)