Hi,
I did not have plans to implement fallback to the command line tool, but it looks like it can be done without too much of an effort. I will look into this and come back to you.
Hi Stianlik,
because I needed it for a project I implemented it dirty so far …
After disabling extension-check I replaced Imagick-Routine with:
$arrPathInfo = pathinfo($filename);
$strFilename = $arrPathInfo[“filename”];
$strFilenameOut = “userdefinedpath/” . $strFilename . “-pdf-image.jpg”;
exec(“convert $filename”.”[0]”.” $strFilenameOut”);
$strReturn = file_get_contents($strFilenameOut);
unlink($strFilenameOut);
return $strReturn;
-
This reply was modified 8 years, 3 months ago by
linuxpinguin. Reason: Deleting thumbnailimage
Hi,
it happens that I also need this for a project.
Appreciate your dirty implementation, unfortunately, I can’t seem to get it to work.
I don’t know why, but the output file is always 0 bytes in size and therefore not being displayed.
I have never worked with the ImageMagick binaries before. Am I missing something here? Which lines do I have to replace exactly?
Thank you for your help.
In File pdf-thumbnails/pdf-thumbnails.php
search for function pdf_thumbnails_admin_int() and use following changes:
function pdf_thumbnails_admin_int()
{
//if (!extension_loaded(‘imagick’)) {
// add_action(‘admin_notices’, ‘pdf_thumbnails_missing_imagick’);
// return;
//}
add_filter(‘wp_generate_attachment_metadata’, ‘pdf_thumbnails_generate_attachment_metadata’, 10, 2);
add_action(‘deleted_post’, ‘pdf_thumbnails_deleted_post’);
}
In file pdf-thumbnails/PdfThumbnailsPlugin.php
search for function getThumbnailBlob($filename) and use following changes:
private function getThumbnailBlob($filename)
{
$blob = apply_filters(‘pdf_thumbnails_generate_image_blob’, null, $filename);
if ($blob) {
return $blob;
}
/*
$imagick = new Imagick($filename);
$imagick->setIteratorIndex(0);
$imagick->setImageFormat(‘jpg’);
return $imagick->getImageBlob();
*/
$arrPathInfo = pathinfo($filename);
$strFilename = $arrPathInfo[“filename”];
$strFilenameOut = “./” . $strFilename . “-pdf-image.jpg”;
exec(“convert $filename”.”[0]”.” $strFilenameOut”);
$strReturn = file_get_contents($strFilenameOut);
unlink($strFilenameOut);
return $strReturn;
}
Hi,
thank you for your detailed explanation.
Also realized that Ghostscript was missing on my server.
Everything is working now. 🙂