|
23 | 23 | * @package PosterEditor |
24 | 24 | * @author Anton Lukin <anton@lukin.me> |
25 | 25 | * @license MIT License (http://www.opensource.org/licenses/mit-license.php) |
26 | | - * @version Release: 5.12 |
| 26 | + * @version Release: 5.13 |
27 | 27 | * @link https://github.com/antonlukin/poster-editor |
28 | 28 | */ |
29 | 29 | class PosterEditor |
@@ -124,12 +124,13 @@ public function make($data) |
124 | 124 | * |
125 | 125 | * Paste a given image source over the current image with an optional position. |
126 | 126 | * |
127 | | - * @param string $data Binary data or path to file or another class instance. |
128 | | - * @param array $options List of x/y relative offset coords from top left corner. Default: centered. |
| 127 | + * @param string $data Binary data or path to file or another class instance. |
| 128 | + * @param array $options List of x/y relative offset coords from top left corner. Default: centered. |
| 129 | + * @param array $boundary Optional. Actual dimensions of the drawn image. |
129 | 130 | * |
130 | 131 | * @return $this |
131 | 132 | */ |
132 | | - public function insert($data, $options = array()) |
| 133 | + public function insert($data, $options = array(), &$boundary = array()) |
133 | 134 | { |
134 | 135 | $defaults = array( |
135 | 136 | 'x' => null, |
@@ -158,6 +159,13 @@ public function insert($data, $options = array()) |
158 | 159 | imagecopyresampled($this->resource, $source, $options['x'], $options['y'], 0, 0, $width, $height, $width, $height); |
159 | 160 | imagedestroy($source); |
160 | 161 |
|
| 162 | + $boundary = array( |
| 163 | + 'x' => $options['x'], |
| 164 | + 'y' => $options['y'], |
| 165 | + 'width' => $width, |
| 166 | + 'height' => $height, |
| 167 | + ); |
| 168 | + |
161 | 169 | return $this; |
162 | 170 | } |
163 | 171 |
|
@@ -774,13 +782,11 @@ public function text($text, $options = array(), &$boundary = array()) |
774 | 782 | $lines = explode(PHP_EOL, $text); |
775 | 783 |
|
776 | 784 | // Set default boundary vaules. |
777 | | - $boundary = array_merge( |
778 | | - array( |
779 | | - 'x' => $options['x'], |
780 | | - 'y' => $options['y'], |
781 | | - 'width' => 0, |
782 | | - 'height' => 0, |
783 | | - ) |
| 785 | + $boundary = array( |
| 786 | + 'x' => $options['x'], |
| 787 | + 'y' => $options['y'], |
| 788 | + 'width' => 0, |
| 789 | + 'height' => 0, |
784 | 790 | ); |
785 | 791 |
|
786 | 792 | foreach ($lines as $index => $line) { |
|
0 commit comments