Reputation: 1851
Anyone know of a way to use PHP on an apache server to convert ppt/pptx slides into images on the server?
As I understand it, one way is to install microsoft powerpoint (or openoffice maybe?) on the server in order to save the powerpoint as images?
How would you go about installing it on the server?
What if installing a program on the server is not possible?
I've seen the COM class used to open up the application on a local machine and save the ppt/pptx as images ... but on a remote machine, the COM class does not exist.
Any help/leads would be greatly appreciated!
EDIT:
I see that the COM class is a Windows Only Extension ... So then what other ways are there?
Thanks again!
Upvotes: 2
Views: 7217
Reputation: 2800
You can use following Library API for converting ppt files to jpg
require __DIR__ . '/../lib/ConvertApi/autoload.php';
use \ConvertApi\ConvertApi; ConvertApi::setApiSecret(CONVERT_API_SECRET);
$result = ConvertApi::convert('jpg', [
'File' => '/path/to/ppt',
], 'pptx'
);
$result->saveFiles('/path/to/result/dir');
Upvotes: 1
Reputation: 1851
The server is an Amazon EC2 instance, so for the most part, its only CLI.
What I've done is:
I've installed Libreoffice (headless) for converting documents to PDF's using exec()
in PHP.
From there I use ghostscript (already installed on the server) to extract images from the generated PDF by using exec()
as well.
Upvotes: 2
Reputation: 918
getting images from the slides in php can be pritty painfull as Mark Baker descriped, however if you now some VBA you cann quite simply make an vba marco to export each slide to an jpg. than uploading the jpg's all together at once seems an easier fix to me, ofcaurse is this not exactly what you wanted. just my two sense.
here is an VBA example: http://vbadud.blogspot.nl/2009/05/save-powerpoint-slides-as-images-using.html
Upvotes: 0
Reputation: 212402
OpenOffice supports a programming interface called UNO, that can be called from PHP using the PUNO extension, which can be used in Windows or Linux (but not Mac) servers.
It does require Open Office to be installed on the server, with Java support enabled and listening on a TCP/IP socket. As this isn't default configuration, it does involve some setup. You'd also have to download PUNO and add it to your PHP configuration.
Upvotes: 5