Is it possible to generate thumbnails for .PPT and .PPTX files using PHP? I am currently doing the same for images and pdf files but hitting walls when it comes to power point presentations.
I am currently using Imagick for the PDF using the code below.
if(in_array($ext,array('pdf'))){
$pdf = './uploads/'.$new_file_name;
$filename=str_replace($ext,'jpg',$new_file_name);
$img = new imagick($pdf);
for ($x = 1;$x <= $img->getNumberImages(); $x++) {
$save_to = './uploads/'.$x.'-'.$filename;
$img->setIteratorIndex($x);
$img->setImageFormat('jpg');
$geo=$img->getImageGeometry();
$sizex=$geo['width'] / 2;
$sizey=$geo['height'] / 2;
$img->resizeImage($sizex,$sizey,Imagick::FILTER_LANCZOS,1);
$img->writeImage($save_to);
}
$count = $img->getNumberImages();
$update = '[pdf=/uploads/'.$new_file_name.']/uploads/'.$count.'-'.$filename.'[/pdf]'.$update;
}
No.
Or at least almost certainly not. You could call \Imagick::queryformats(); to list the formats that Imagick, or rather ImageMagick, supports to double-check that PowerPoint formats are not supported, but as they aren't listed as supported then I doubt they will be.
It seems one of the best ways to do achieve the same thing is to use unoconv to convert the PowerPoint file to PDF first:
unoconv -f pdf presentation.ppt
After that you would be able to manipulate it with Imagick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With