本文整理汇总了PHP中createIcon函数的典型用法代码示例。如果您正苦于以下问题:PHP createIcon函数的具体用法?PHP createIcon怎么用?PHP createIcon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createIcon函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例3: markTransfer
function markTransfer($marker)
{
global $transfer_marker_img;
echo "// mark station\n";
$station_name = $marker->name;
echo "var name = \"{$station_name}\";\n";
$station_lat = $marker->getLat();
$station_lng = $marker->getLng();
echo "var point = new GLatLng({$station_lat},{$station_lng});\n";
$lines = $marker->getLines();
$length = count($lines);
//$length = count($station) - 1;
echo "var lines = new Array({$length});\n";
for ($i = 0; $i < $length; $i++) {
$line = $lines[$i];
echo "lines[{$i}] = \"{$line->name}\";\n";
}
createIcon($transfer_marker_img);
echo "var marker = createStation2(point, name, lines, icon);\n";
echo "map.addOverlay(marker);\n\n";
}
示例4: createImage
/**
* create the image from the db or uploaded file
*/
function createImage($categoryID,$filename,$extension,$fileType,$fileSize,$fileID) {
//create a folder within images
global $system_default_path,$home_url,$default_randomlower,$default_randomupper;
global $image_dir0,$image_dir1,$image_dir2,$image_dir3,$image_dir4;
global $gallery;
$dir=0;
$dir=rand($default_randomlower,$default_randomupper);
//use any of the five folders under images
$folderarray=array();
$folderarray[0]=$image_dir0;
$folderarray[1]=$image_dir1;
$folderarray[2]=$image_dir2;
$folderarray[3]=$image_dir3;
$folderarray[4]=$image_dir4;
//pick the variable
$var=0;
$var=rand(0,4);
//setup the path
$path=0;
$path=$system_default_path."images/$folderarray[$var]/";
//make a $path dir
if(!is_dir($path)) {
mkdir($path,0755);
chmod($path,0755);
}
//append to the path
$path.="_$dir/";
//make a $path dir
if(!is_dir($path)) {
mkdir($path,0755);
chmod($path,0755);
}
//remove spaces
$filename=removeSpaces($filename,".");
//avoid conflicts
$filename=removeFileConflict($path,$filename);
//file creation
$image=0;
switch($extension) {
case GIF:
case gif:
if(function_exists("imagegif")) {
$image=ImageCreateFromGIF($_FILES['userfile']['tmp_name']);
ImageGIF($image,$path.$filename);
chmod($path.$filename,0755);
}
break;
case JPEG:
case jpeg:
case JPG:
case jpg:
if(function_exists("imagejpeg")) {
$image=ImageCreateFromJPEG($_FILES['userfile']['tmp_name']);
ImageJPEG($image,$path.$filename);
chmod($path.$filename,0755);
}
break;
case PNG:
case png:
if(function_exists("imagepng")) {
$image=ImageCreateFromPNG($_FILES['userfile']['tmp_name']);
ImagePNG($image,$path.$filename);
chmod($path.$filename,0755);
}
break;
}
if($gallery) {
//create an icon 49 x 49
createIcon("small",$path,$path.$filename,$filename,49,49,$extension,$home_url."images/$folderarray[$var]/_$dir/");
//resize image to 386 x 256
resizeImage($path,$path.$filename,$filename,386,256,$extension);
//db storage
$fileData=0;
$fileData=addslashes(file_get_contents($path.$filename));
//filesize
$fileSize=0;
$fileSize=filesize($path.$filename);
//update the db record
mysqlquery("update vl_filenames set
file='$fileData',
size='$fileSize'
where id='$fileID'");
}
return $path.$filename." :: ".$home_url."images/$folderarray[$var]/_$dir/$filename";
}