|
@@ 39-57 (lines=19) @@
|
| 36 |
|
* |
| 37 |
|
* @return $this |
| 38 |
|
*/ |
| 39 |
|
public function original($src, $height, $width) |
| 40 |
|
{ |
| 41 |
|
if (! filter_var($src, FILTER_VALIDATE_URL)) { |
| 42 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Source of image in attachment is missing or invalid.'); |
| 43 |
|
} |
| 44 |
|
$this->original['src'] = $src; |
| 45 |
|
|
| 46 |
|
if (! filter_var($height, FILTER_VALIDATE_INT) or $height <= 0) { |
| 47 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Height of image in attachment is missing or invalid.'); |
| 48 |
|
} |
| 49 |
|
$this->original['height'] = $height; |
| 50 |
|
|
| 51 |
|
if (! filter_var($width, FILTER_VALIDATE_INT) or $width <= 0) { |
| 52 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Width of image in attachment is missing or invalid.'); |
| 53 |
|
} |
| 54 |
|
$this->original['width'] = $width; |
| 55 |
|
|
| 56 |
|
return $this; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* Attach thumbnail to attachment. |
|
@@ 68-86 (lines=19) @@
|
| 65 |
|
* |
| 66 |
|
* @return $this |
| 67 |
|
*/ |
| 68 |
|
public function thumbnail($src, $height, $width) |
| 69 |
|
{ |
| 70 |
|
if (! filter_var($src, FILTER_VALIDATE_URL)) { |
| 71 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Source of image in attachment is missing or invalid.'); |
| 72 |
|
} |
| 73 |
|
$this->thumbnail['src'] = $src; |
| 74 |
|
|
| 75 |
|
if (! filter_var($height, FILTER_VALIDATE_INT) or $height <= 0) { |
| 76 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Height of image in attachment is missing or invalid.'); |
| 77 |
|
} |
| 78 |
|
$this->thumbnail['height'] = $height; |
| 79 |
|
|
| 80 |
|
if (! filter_var($width, FILTER_VALIDATE_INT) or $width <= 0) { |
| 81 |
|
throw CouldNotSendNotification::flockAttachmentViewImageException('Width of image in attachment is missing or invalid.'); |
| 82 |
|
} |
| 83 |
|
$this->thumbnail['width'] = $width; |
| 84 |
|
|
| 85 |
|
return $this; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
/** |
| 89 |
|
* Add file name to attached image. |