本文整理汇总了PHP中preprocessProfilePicture函数的典型用法代码示例。如果您正苦于以下问题:PHP preprocessProfilePicture函数的具体用法?PHP preprocessProfilePicture怎么用?PHP preprocessProfilePicture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preprocessProfilePicture函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendSetPicture
/**
* Set your profile picture
*
* @param string $jid
* @param string $filepath
* URL or localpath to image file
*/
protected function sendSetPicture($jid, $filepath)
{
if (stripos($filepath, 'http') !== false && !preg_match('/\\s/', $filepath)) {
$extension = end(explode(".", $filepath));
$newImageName = rand(0, 100000);
$imagePath = static::PICTURES_FOLDER . "/" . $newImageName . ".jpg";
if ($extension == 'jpg') {
copy($filepath, $imagePath);
$filepath = $imagePath;
}
}
preprocessProfilePicture($filepath);
$fp = @fopen($filepath, "r");
if ($fp) {
$data = fread($fp, filesize($filepath));
if ($data) {
//this is where the fun starts
$picture = new ProtocolNode("picture", null, null, $data);
$icon = createIconGD($filepath, 96, true);
$thumb = new ProtocolNode("picture", array("type" => "preview"), null, $icon);
$hash = array();
$nodeID = $this->createMsgId("setphoto");
$hash["id"] = $nodeID;
$hash["to"] = $this->getJID($jid);
$hash["type"] = "set";
$hash["xmlns"] = "w:profile:picture";
$node = new ProtocolNode("iq", $hash, array($picture, $thumb), null);
$this->sendNode($node);
$this->waitForServer($nodeID);
}
}
}
示例2: sendSetPicture
/**
* Set your profile picture
*
* @param string $jid
* @param string $filepath
* URL or localpath to image file
*/
protected function sendSetPicture($jid, $filepath)
{
preprocessProfilePicture($filepath);
$fp = @fopen($filepath, "r");
if ($fp) {
$data = fread($fp, filesize($filepath));
if ($data) {
//this is where the fun starts
$picture = new ProtocolNode("picture", null, null, $data);
$icon = createIconGD($filepath, 96, true);
$thumb = new ProtocolNode("picture", array("type" => "preview"), null, $icon);
$hash = array();
$nodeID = $this->createMsgId("setphoto");
$hash["id"] = $nodeID;
$hash["to"] = $this->getJID($jid);
$hash["type"] = "set";
$hash["xmlns"] = "w:profile:picture";
$node = new ProtocolNode("iq", $hash, array($picture, $thumb), null);
$this->sendNode($node);
$this->waitForServer($nodeID);
}
}
}
示例3: sendSetPicture
/**
* Set your profile picture.
*
* @param string $jid
* @param string $filepath URL or localpath to image file
*/
protected function sendSetPicture($jid, $filepath)
{
$nodeID = $this->createIqId();
$data = preprocessProfilePicture($filepath);
$preview = createIconGD($filepath, 96, true);
$picture = new ProtocolNode('picture', ['type' => 'image'], null, $data);
$preview = new ProtocolNode('picture', ['type' => 'preview'], null, $preview);
$node = new ProtocolNode('iq', ['id' => $nodeID, 'to' => $this->getJID($jid), 'type' => 'set', 'xmlns' => 'w:profile:picture'], [$picture, $preview], null);
$this->sendNode($node);
}
示例4: sendSetPicture
/**
* Set your profile picture
*
* @param string $jid
* @param string $filepath URL or localpath to image file
*/
protected function sendSetPicture($jid, $filepath)
{
$nodeID = $this->createIqId();
$data = preprocessProfilePicture($filepath);
$preview = createIconGD($filepath, 96, true);
$picture = new ProtocolNode("picture", array("type" => "image"), null, $data);
$preview = new ProtocolNode("picture", array("type" => "preview"), null, $preview);
$node = new ProtocolNode("iq", array('id' => $nodeID, 'to' => $this->getJID($jid), 'type' => 'set', 'xmlns' => 'w:profile:picture'), array($picture, $preview), null);
$this->sendNode($node);
$this->waitForServer($nodeID);
}
示例5: sendSetPicture
/**
* Set your profile picture
*
* @param string $jid
* @param string $filepath
* URL or localpath to image file
*/
protected function sendSetPicture($jid, $filepath)
{
$data = preprocessProfilePicture($filepath);
$preview = createIconGD($filepath, 96, true);
$picture = new ProtocolNode("picture", array("type" => "image"), null, $data);
$preview = new ProtocolNode("picture", array("type" => "preview"), null, $preview);
$hash = array();
$nodeID = $this->createMsgId("setphoto");
$hash["id"] = $nodeID;
$hash["to"] = $this->getJID($jid);
$hash["type"] = "set";
$hash["xmlns"] = "w:profile:picture";
$node = new ProtocolNode("iq", $hash, array($picture, $preview), null);
$this->sendNode($node);
$this->waitForServer($nodeID);
}