note 104855 added to function.imagick-setoption
| From: | alexandre at gaigalas dot net | Date: | Mon, 11 Jul 2011 21:43:37 +0000 |
| Subject: | note 104855 added to function.imagick-setoption | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181425@lists.php.net to get a copy of this message | ||
If you want to extract a preview from a PDF file using the CropBox instead of the whole document,
setOption() is the right method:
<?php
$handler = new Imagick();
$handler->setOption('pdf:use-cropbox', 'true');
$handler->readImage($imageFileName);
$handler->thumbnailImage(200, 200, true);
$handler->setImageFormat('jpeg');
$handler->writeImage($destThumbFileName);
?>
It is the equivalent to the -define pdf:use-cropbox=true for the convert command line tool.
pdf:use-trimbox is also available.
Note that on my environment the setOption only worked when i called it before the readImage method,
which means that you can't pass the filename to the Imagick constructor directly.
----
Server IP: 69.147.83.197
Probable Submitter: 187.61.15.124
----
Manual Page -- http://www.php.net/manual/en/function.imagick-setoption.php
Edit -- https://master.php.net/note/edit/104855
Del: integrated -- https://master.php.net/note/delete/104855/integrated
Del: useless -- https://master.php.net/note/delete/104855/useless
Del: bad code -- https://master.php.net/note/delete/104855/bad+code
Del: spam -- https://master.php.net/note/delete/104855/spam
Del: non-english -- https://master.php.net/note/delete/104855/non-english
Del: in docs -- https://master.php.net/note/delete/104855/in+docs
Del: other reasons-- https://master.php.net/note/delete/104855
Reject -- https://master.php.net/note/reject/104855
Search -- https://master.php.net/manage/user-notes.php