php將ppt轉(zhuǎn)jpg圖片的具體步驟代碼
PHP將ppt轉(zhuǎn)成圖片查看
PHP安裝COM組件
1、如php版本>5.3.15,需要保證ext文件夾下有php_com_dotnet.dell 并在php.ini中加入。
extension=php_com_dotnet.dll
2、去除com.allow_dcom = true前面的‘;'號(hào)。
com.allow_dcom = true
實(shí)例
$powerpnt = new COM("powerpoint.application") or die("Unable to instantiate Powerpoint");
$file='E:/APP/OTHER/qwe.pptx';
$presentation = $powerpnt->Presentations->Open(realpath($file), false, false, false) or die("Unable to open presentation");
foreach($presentation->Slides as $slide)
{
$slideName = "Slide_" . $slide->SlideNumber;
$uploadsFolder = 'iii';
$exportFolder = realpath($uploadsFolder);
$slide->Export($exportFolder."http://".$slideName.".jpg", "jpg", "600", "400");
}
$presentation->Close();
$powerpnt->Quit();
$powerpnt = null;
?>
內(nèi)容擴(kuò)展:
從shell腳本中,您可以使用Unoconv,它是LibreOffice的簡(jiǎn)單命令行包裝器,可以使您轉(zhuǎn)換為合理的質(zhì)量。
對(duì)于可以直接從PHP(以及Linux)調(diào)用的具有更高質(zhì)量輸出的解決方案,您可以使用專(zhuān)用文件轉(zhuǎn)換API,例如Zamzar。
提交PPT(或PPTX)文件以轉(zhuǎn)換為JPEG的代碼如下(documentation中的更多信息):
/ Build request $endpoint = "https://api.zamzar.com/v1/jobs"; $apiKey = "YOUR_KEY"; $sourceFilePath = "/tmp/my.ppt"; // Or PPTX $targetFormat = "jpg"; $sourceFile = curl_file_create($sourceFilePath); $postData = array( "source_file" => $sourceFile, "target_format" => $targetFormat ); // Send request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $endpoint); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $apiKey . ":"); $body = curl_exec($ch); curl_close($ch); // Process response (with link to converted files) $response = json_decode($body, true); print_r($response); ?>
到此這篇關(guān)于php將ppt轉(zhuǎn)jpg圖片的具體步驟代碼的文章就介紹到這了,更多相關(guān)php將ppt轉(zhuǎn)jpg圖片的方法內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
php正則去除網(wǎng)頁(yè)中所有的html,js,css,注釋的實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇php正則去除網(wǎng)頁(yè)中所有的html,js,css,注釋的實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-11-11
php過(guò)濾html中的其他網(wǎng)站鏈接的方法(域名白名單功能)
這篇文章主要介紹了php過(guò)濾html中的其他網(wǎng)站鏈接的方法(域名白名單功能),需要的朋友可以參考下2014-04-04
SQL注入寬字節(jié)注入由淺到深學(xué)習(xí)
這篇文章主要為大家介紹了SQL注入寬字節(jié)注入由淺到深學(xué)習(xí),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-02-02
深入解析Laravel5.5中的包自動(dòng)發(fā)現(xiàn)Package Auto Discovery
眾所周知Laravel 5.5 發(fā)布在即,目前已經(jīng)確定會(huì)增加一個(gè)神奇的新特性:Package Auto Discovery。下面這篇文章主要給大家深入的介紹了關(guān)于Laravel5.5中包自動(dòng)發(fā)現(xiàn)Package Auto Discovery的相關(guān)資料,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。2017-09-09
實(shí)例(Smarty+FCKeditor新聞系統(tǒng))
實(shí)例(Smarty+FCKeditor新聞系統(tǒng))...2007-01-01

