php自动获取ppt封面图片,帮忙看下,这个程序实现使用office的COM组件将ppt转换为图片...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

本人比较菜,看不出来为什么,只支持office2003或者是office2007.请问如何能改为更高版本的吗,因为这两个版本只有32位的,在64位系统下调用不到COM组件。

/*********************/

/* */

/* Dezend for PHP5 */

/* NWS */

/* Nulled.WS */

/* */

/*********************/

$debug = true;

header( "Content-Type:text/xml;charset=UTF-8" );

header( "Cache-Control: no-store, no-cache, must-revalidate" );

header( "Cache-Control: post-check=0, pre-check=0", false );

require_once( "../inc/inc.php" );

$uploadFileName = $_FILES[*Filedata*][*name*];

$uploadFile = $_FILES[*Filedata*][*tmp_name*];

$localFormat = getFileExt( $uploadFileName );

$is_allowed_upload = true;

$forbbidenFileType = array( "php", "sh", "exe", "bat" );

putlog( "1: ".api_get_path( SYS_PATH ));

foreach ( $forbbidenFileType as $value )

{

if ( strtolower( $localFormat ) == $value )

{

$is_allowed_upload = false;

break;

break;

}

}

if ( strtolower( $localFormat ) != "ppt" )

{

$is_allowed_upload = false;

}

if ( $is_allowed_upload && is_uploaded_file( $uploadFile ) )

{

$extendType = getFileExt( $uploadFileName );

$localFileName = trim( $_GET[*fileName*] );

$localFile = api_get_path( SYS_PATH )."meeting/pptUpload/".$localFileName;

if ( move_uploaded_file( $uploadFile, $localFile ) )

{

$pos = strrpos( $localFileName, "." );

$len = strlen( $uploadFileName );

$folder = substr( $localFileName, 0, $pos );

$create_date = date( "Y-m-d h:i:s" );

if ( !( $ppt = new COM( "powerpoint.application" ) ) )

{

exit( "Unable to Open MSPowerPoint" );

}

putlog( "断点1 ".$localFile ." ..");

$ppt->Visible = true;

putlog( "断点2 " );

$ppt->Presentations->Open( realpath( $localFile ) );

putlog( "断点3 " );

$pptCount = $ppt->activePresentation->Slides->Count;

$export_folder = api_get_path( SYS_PATH )."meeting/pptUpload/".$folder;

if ( !file_exists( $export_folder ) )

{

mkdir( $export_folder, 511 );

}

$ppt->activePresentation->Export( $export_folder, "JPG", 640, 480 );

$ppt->Quit( );

$sql = "insert into attachment (file_name,local_file_name,meet_no,file_size,file_type,created_time,model_type) values (*".$uploadFileName."*,*".$folder."*,*". trim( $_GET[*roomID*] )."*,*".$pptCount."*,*".$extendType."*,NOW(),*PRESENTATION*)";

$rs = api_sql_query( $sql, __FILE__, 61 );

if ( !$rs && $debug )

{ putlog("insert zlchat pptFile -".$uploadFileName." ERROR!");

error_log( "insert zlchat pptFile -".$uploadFileName." ERROR!", 0 );

}else

putlog($sql);

$path2 = api_get_path( SYS_PATH )."meeting/pptUpload/".$folder."/";

$handle = opendir( $path2 );

while ( $file = readdir( $handle ) )

{

if ( !is_dir( $file ) )

{

preg_match_all( "/(\\d+)\\.JPG$/", $file, $name_arr );

$newName = $name_arr[0][0];

rename( $path2.$file, $path2.$newName );

}

}

closedir( $handle );

}

else

{

if ( $debug )

{

error_log( "upload zlchat pptFile -".$uploadFileName." ERROR!", 0 );

}

}

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值