note 116812 added to imagick.readimage
| From: | lindsay at axys dot co dot nz | Date: | Tue, 03 Mar 2015 23:53:03 +0000 |
| Subject: | note 116812 added to imagick.readimage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201849@lists.php.net to get a copy of this message | ||
If you have just uploaded the PDF and want to generate an image from the first page, the [0] needs
to be added to the image name as a text string.
$filename =
getSafeFileName($uploaddir,basename($_FILES['brochure_pdf']['name'],
$overwrite));
$uploadfile = $uploaddir . $filename;
if (move_uploaded_file($_FILES['brochure_pdf']['tmp_name'], $uploadfile)) {
$brochure_pdf = $filename;
$im = new Imagick();
$im->setResolution(80,80);
$im->readimage($uploadfile."[0]");
$im->setImageFormat('jpeg');
$image_name = "save_as_name.jpg";
$imageprops = $im->getImageGeometry();
if ($imageprops['width'] <= 175 && $imageprops['height'] <=
300) {
// don't upscale
} else {
$im->resizeImage(175,300, imagick::FILTER_LANCZOS, 0.9, true);
}
$im->writeImage($uploaddir .$image_name);
$im->clear();
$im->destroy();
----
Server IP: 72.52.91.14
Probable Submitter: 119.224.39.43
----
Manual Page -- http://php.net/manual/en/imagick.readimage.php
Edit -- https://master.php.net/note/edit/116812
Del: integrated -- https://master.php.net/note/delete/116812/integrated
Del: useless -- https://master.php.net/note/delete/116812/useless
Del: bad code -- https://master.php.net/note/delete/116812/bad+code
Del: spam -- https://master.php.net/note/delete/116812/spam
Del: non-english -- https://master.php.net/note/delete/116812/non-english
Del: in docs -- https://master.php.net/note/delete/116812/in+docs
Del: other reasons-- https://master.php.net/note/delete/116812
Reject -- https://master.php.net/note/reject/116812
Search -- https://master.php.net/manage/user-notes.php