本文整理汇总了PHP中createVideoIcon函数的典型用法代码示例。如果您正苦于以下问题:PHP createVideoIcon函数的具体用法?PHP createVideoIcon怎么用?PHP createVideoIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createVideoIcon函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processUploadResponse
/**
* Process media upload response
*
* @param ProtocolNode $node
* Message node
* @return bool
*/
protected function processUploadResponse($node)
{
$id = $node->getAttribute("id");
$messageNode = @$this->mediaQueue[$id];
if ($messageNode == null) {
//message not found, can't send!
$this->eventManager()->fireMediaUploadFailed($this->phoneNumber, $id, $node, $messageNode, "Message node not found in queue");
return false;
}
$duplicate = $node->getChild("duplicate");
if ($duplicate != null) {
//file already on whatsapp servers
$url = $duplicate->getAttribute("url");
$filesize = $duplicate->getAttribute("size");
// $mimetype = $duplicate->getAttribute("mimetype");
$filehash = $duplicate->getAttribute("filehash");
$filetype = $duplicate->getAttribute("type");
// $width = $duplicate->getAttribute("width");
// $height = $duplicate->getAttribute("height");
$exploded = explode("/", $url);
$filename = array_pop($exploded);
} else {
//upload new file
$json = WhatsMediaUploader::pushFile($node, $messageNode, $this->mediaFileInfo, $this->phoneNumber);
if (!$json) {
//failed upload
$this->eventManager()->fireMediaUploadFailed($this->phoneNumber, $id, $node, $messageNode, "Failed to push file to server");
return false;
}
$url = $json->url;
$filesize = $json->size;
// $mimetype = $json->mimetype;
$filehash = $json->filehash;
$filetype = $json->type;
// $width = $json->width;
// $height = $json->height;
$filename = $json->name;
}
$mediaAttribs = array();
$mediaAttribs["xmlns"] = "urn:xmpp:whatsapp:mms";
$mediaAttribs["type"] = $filetype;
$mediaAttribs["url"] = $url;
$mediaAttribs["file"] = $filename;
$mediaAttribs["size"] = $filesize;
$mediaAttribs["hash"] = $filehash;
$filepath = $this->mediaQueue[$id]['filePath'];
$to = $this->mediaQueue[$id]['to'];
switch ($filetype) {
case "image":
$icon = createIcon($filepath);
break;
case "video":
$icon = createVideoIcon($filepath);
break;
default:
$icon = '';
break;
}
$mediaNode = new ProtocolNode("media", $mediaAttribs, null, $icon);
if (is_array($to)) {
$this->sendBroadcast($to, $mediaNode, "media");
} else {
$this->sendMessageNode($to, $mediaNode);
}
$this->eventManager()->fireMediaMessageSent($this->phoneNumber, $to, $id, $filetype, $url, $filename, $filesize, $filehash, $icon);
return true;
}
示例2: processUploadResponse
/**
* Process media upload response.
*
* @param ProtocolNode $node Message node
*
* @return bool
*/
public function processUploadResponse($node)
{
$id = $node->getAttribute('id');
$messageNode = @$this->mediaQueue[$id];
if ($messageNode == null) {
//message not found, can't send!
$this->eventManager()->fire('onMediaUploadFailed', [$this->phoneNumber, $id, $node, $messageNode, 'Message node not found in queue']);
return false;
}
$duplicate = $node->getChild('duplicate');
if ($duplicate != null) {
//file already on whatsapp servers
$url = $duplicate->getAttribute('url');
$filesize = $duplicate->getAttribute('size');
// $mimetype = $duplicate->getAttribute("mimetype");
$filehash = $duplicate->getAttribute('filehash');
$filetype = $duplicate->getAttribute('type');
// $width = $duplicate->getAttribute("width");
// $height = $duplicate->getAttribute("height");
$exploded = explode('/', $url);
$filename = array_pop($exploded);
} else {
//upload new file
$json = WhatsMediaUploader::pushFile($node, $messageNode, $this->mediaFileInfo, $this->phoneNumber);
if (!$json) {
//failed upload
$this->eventManager()->fire('onMediaUploadFailed', [$this->phoneNumber, $id, $node, $messageNode, 'Failed to push file to server']);
return false;
}
$url = $json->url;
$filesize = $json->size;
// $mimetype = $json->mimetype;
$filehash = $json->filehash;
$filetype = $json->type;
// $width = $json->width;
// $height = $json->height;
$filename = $json->name;
}
$mediaAttribs = [];
$mediaAttribs['type'] = $filetype;
$mediaAttribs['url'] = $url;
$mediaAttribs['encoding'] = 'raw';
$mediaAttribs['file'] = $filename;
$mediaAttribs['size'] = $filesize;
if ($this->mediaQueue[$id]['caption'] != '') {
$mediaAttribs['caption'] = $this->mediaQueue[$id]['caption'];
}
if ($this->voice == true) {
$mediaAttribs['origin'] = 'live';
$this->voice = false;
}
$filepath = $this->mediaQueue[$id]['filePath'];
$to = $this->mediaQueue[$id]['to'];
switch ($filetype) {
case 'image':
$caption = $this->mediaQueue[$id]['caption'];
$icon = createIcon($filepath);
break;
case 'video':
$caption = $this->mediaQueue[$id]['caption'];
$icon = createVideoIcon($filepath);
break;
default:
$caption = '';
$icon = '';
break;
}
//Retrieve Message ID
$message_id = $messageNode['message_id'];
$mediaNode = new ProtocolNode('media', $mediaAttribs, null, $icon);
if (is_array($to)) {
$this->sendBroadcast($to, $mediaNode, 'media');
} else {
$this->sendMessageNode($to, $mediaNode, $message_id);
}
$this->eventManager()->fire('onMediaMessageSent', [$this->phoneNumber, $to, $message_id, $filetype, $url, $filename, $filesize, $filehash, $caption, $icon]);
return true;
}