LiveDocx が参照するファイルの名前だけを保存していることに気付きませんでした。私はこれを使用して見つけました:
$mailMerge->listImages();
フォーマットは次のように返されました。
array
0 => array
'filename' => string 'directory_logo.png' (length=18)
'fileSize' => int 12829
'createTime' => int 1352835686
'modifyTime' => int 1352835686
したがって、テンプレート ファイルは次の形式で問題ありませんでした。
«image:photo»
別名
{ MERGEFIELD image:photo \* MERGEFORMAT }
しかし、私のphpは次のようにする必要がありました:
$mailMerge->uploadImage($this->logo_path);
$mailMerge->assign('image:photo', $this->logo_file);
私の完全な作業コードは次のようになります。
$mailMerge = new Zend_Service_LiveDocx_MailMerge();
$mailMerge->setUsername($username)
->setPassword($password);
$mailMerge->setLocalTemplate($template_path . '/service_template.docx');
$mailMerge->uploadImage($this->logo_path);
$mailMerge->assign('image:photo', 'directory_logo.png');
$mailMerge->createDocument();
$document = $mailMerge->retrieveDocument('docx');
file_put_contents($this->config->livedocx->document . '/' . $this->prefs['serverid'] . '/service_directory.docx', $document);
$mailMerge->deleteImage('directory_logo.png');