File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,11 @@ You can set the quality of compression from 0 to 100:
66
66
$pdf->setCompressionQuality(100); // sets the compression quality to maximum
67
67
```
68
68
69
- You can create a thumbnail of the pdf :
69
+ You can specify the width of the resulting image :
70
70
``` php
71
- $pdf->setThumbnailWidth(400)
72
- ->saveImage($pathToWhereImageShouldBeStored);
71
+ $pdf
72
+ ->width(400)
73
+ ->saveImage($pathToWhereImageShouldBeStored);
73
74
```
74
75
75
76
## Issues regarding Ghostscript
Original file line number Diff line number Diff line change @@ -168,13 +168,13 @@ public function getImageData(string $pathToImage): Imagick
168
168
if (is_int ($ this ->layerMethod )) {
169
169
$ this ->imagick = $ this ->imagick ->mergeImageLayers ($ this ->layerMethod );
170
170
}
171
-
171
+
172
172
if ($ this ->thumbnailWidth !== null ) {
173
173
$ this ->imagick ->thumbnailImage ($ this ->thumbnailWidth , 0 );
174
174
}
175
175
176
176
$ this ->imagick ->setFormat ($ this ->determineOutputFormat ($ pathToImage ));
177
-
177
+
178
178
return $ this ->imagick ;
179
179
}
180
180
@@ -192,7 +192,7 @@ public function setCompressionQuality(int $compressionQuality)
192
192
return $ this ;
193
193
}
194
194
195
- public function setThumbnailWidth (int $ thumbnailWidth )
195
+ public function width (int $ thumbnailWidth )
196
196
{
197
197
$ this ->thumbnailWidth = $ thumbnailWidth ;
198
198
Original file line number Diff line number Diff line change 54
54
$ imagick = (new Pdf ($ this ->testFile ))
55
55
->setOutputFormat ('png ' )
56
56
->getImageData ('test.png ' );
57
-
57
+
58
58
expect ($ imagick ->getFormat ())->toEqual ('png ' );
59
59
expect ($ imagick ->getFormat ())->not ->toEqual ('jpg ' );
60
60
});
65
65
->setResolution (72 )
66
66
->getImageData ('test.jpg ' )
67
67
->getImageResolution ();
68
-
68
+
69
69
expect ($ image ['x ' ])->toEqual (72 );
70
70
expect ($ image ['y ' ])->toEqual (72 );
71
71
});
80
80
81
81
it ('will create a thumbnail at specified width ' , function () {
82
82
$ imagick = (new Pdf ($ this ->multipageTestFile ))
83
- ->setThumbnailWidth (400 )
83
+ ->width (400 )
84
84
->getImageData ('test.jpg ' )
85
85
->getImageGeometry ();
86
86
87
87
expect ($ imagick ['width ' ])->toBe (400 );
88
- });
88
+ });
You can’t perform that action at this time.
0 commit comments