Hi,
I've managed to generate frontend thumbnails of PDF files with the help of phpthumbof and Imagemagick/Postscript in Revolution 2.2.2.
Sadly, I'm not able to show these thumbnails in the manager backend as well. Since it works for the frontend, I do not see any reason why it should not work in the Manager.
Did somebody do this successfully in the past? Any hints?
Thanks.
That is exactly what I am trying to do... I have got Imagemagick/Postscript creating a PDF thumb but I just don't know how to integrate into Modx...
How did you do it?
<?php
if (isset($_POST['submit'])){
$pdfDirectory = "pdf/";
$thumbDirectory = "pdfimage/";
//get the name of the file
$filename = basename( $_FILES['pdf']['name'], ".pdf");
//remove all characters from the file name other than letters, numbers, hyphens and underscores
$filename = preg_replace("/[^A-Za-z0-9_-]/", "", $filename).".pdf";
//name the thumbnail image the same as the pdf file
$thumb = basename($filename, ".pdf");
if(move_uploaded_file($_FILES['pdf']['tmp_name'], $pdfDirectory.$filename)) {
//the path to the PDF file
$pdfWithPath = $pdfDirectory.$filename;
//add the desired extension to the thumbnail
$thumb = $thumb.".jpg";
//execute imageMagick's 'convert', setting the color space to RGB and size to 200px wide
exec("convert \"{$pdfWithPath}[0]\" -colorspace RGB -geometry 200 $thumbDirectory$thumb");
//show the image
echo "<p><a href=\"$pdfWithPath\"><img src=\"pdfimage/$thumb\" alt=\"\" /></a></p>";
}
}
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="pdf" />
<input type="submit" name="submit" value="Upload" />
</form>
Revolution 2.2.0
Developer not a programmer...
Well.... it is easier they I thought... just make a TV with input as image and output as text...
Then call the TV as below setting the width (w), height (h) and which page (sfn) of the PDF you want to thumbnail...
[[*pmyTV:phpthumbof=`w=120&h=120&sfn=0`]]
titanium's problem still remains... no PDF thumb from the backend... any suggestions?
Cheers
Revolution 2.2.0
Developer not a programmer...