Skip to content

Commit 9b8d5ba

Browse files
committed
wip
1 parent 6beafb7 commit 9b8d5ba

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ You can set the quality of compression from 0 to 100:
6666
$pdf->setCompressionQuality(100); // sets the compression quality to maximum
6767
```
6868

69-
You can create a thumbnail of the pdf:
69+
You can specify the width of the resulting image:
7070
```php
71-
$pdf->setThumbnailWidth(400)
72-
->saveImage($pathToWhereImageShouldBeStored);
71+
$pdf
72+
->width(400)
73+
->saveImage($pathToWhereImageShouldBeStored);
7374
```
7475

7576
## Issues regarding Ghostscript

src/Pdf.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ public function getImageData(string $pathToImage): Imagick
168168
if (is_int($this->layerMethod)) {
169169
$this->imagick = $this->imagick->mergeImageLayers($this->layerMethod);
170170
}
171-
171+
172172
if ($this->thumbnailWidth !== null) {
173173
$this->imagick->thumbnailImage($this->thumbnailWidth, 0);
174174
}
175175

176176
$this->imagick->setFormat($this->determineOutputFormat($pathToImage));
177-
177+
178178
return $this->imagick;
179179
}
180180

@@ -192,7 +192,7 @@ public function setCompressionQuality(int $compressionQuality)
192192
return $this;
193193
}
194194

195-
public function setThumbnailWidth(int $thumbnailWidth)
195+
public function width(int $thumbnailWidth)
196196
{
197197
$this->thumbnailWidth = $thumbnailWidth;
198198

tests/PdfTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
$imagick = (new Pdf($this->testFile))
5555
->setOutputFormat('png')
5656
->getImageData('test.png');
57-
57+
5858
expect($imagick->getFormat())->toEqual('png');
5959
expect($imagick->getFormat())->not->toEqual('jpg');
6060
});
@@ -65,7 +65,7 @@
6565
->setResolution(72)
6666
->getImageData('test.jpg')
6767
->getImageResolution();
68-
68+
6969
expect($image['x'])->toEqual(72);
7070
expect($image['y'])->toEqual(72);
7171
});
@@ -80,9 +80,9 @@
8080

8181
it('will create a thumbnail at specified width', function() {
8282
$imagick = (new Pdf($this->multipageTestFile))
83-
->setThumbnailWidth(400)
83+
->width(400)
8484
->getImageData('test.jpg')
8585
->getImageGeometry();
8686

8787
expect($imagick['width'])->toBe(400);
88-
});
88+
});

0 commit comments

Comments
 (0)