當前位置: 首頁>>代碼示例>>PHP>>正文


PHP preprocessProfilePicture函數代碼示例

本文整理匯總了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);
         }
     }
 }
開發者ID:micschk,項目名稱:WhatsAPI,代碼行數:39,代碼來源:whatsprot.class.php

示例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);
         }
     }
 }
開發者ID:nekulin,項目名稱:WhatsAPI,代碼行數:30,代碼來源:whatsprot.class.php

示例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);
 }
開發者ID:Veivan,項目名稱:WABuh,代碼行數:16,代碼來源:whatsprot.class.php

示例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);
 }
開發者ID:rezanadimi72,項目名稱:Chat-API,代碼行數:17,代碼來源:whatsprot.class.php

示例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);
 }
開發者ID:ankurdebnath,項目名稱:WebProjects,代碼行數:23,代碼來源:whatsprot.class.php


注:本文中的preprocessProfilePicture函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。