Log in or register to post comments

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:17pm #1

Hi,

     i am work with vuforia AR . its nice, but i have some problem when  update the target image and metadata package using php. how to solve this problem?, kindly help to me, and then i already used some code from vuforia developer site refernce, and search with google also  and i implemented some code but not  use , in this page (  https://developer.vuforia.com/forum/cloud-recognition/questions-php-developers  ) same like that issues so i refer it but no use, so i need some guidence.Thanks in advance

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 16, 2013 - 6:45am #15

hi,

i got the solution for  updated the target image and meta file package

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 16, 2013 - 5:00am #14
i got this reply but the target image cant updated using php so how  to solve this problem


string 'HTTP/1.1 422 Unprocessable Entity

Server: Apache-Coyote/1.1

Content-Type: application/json;charset=UTF-8

Transfer-Encoding: chunked

Date: Thu, 16 May 2013 11:58:22 GMT



{"result_code":"BadImage","transaction_id":"a88f7a3194794bd5ba68e2f1173e9163"}' (length=253)

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:40pm #13

hi david

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:37pm #12

in that page i already refered and also in that page have lots of code so which part of code i used for my problem solve...

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:35pm #11

Be sure that your target has been processed before trying to update it. There is sample code for updating a target in this thread - https://developer.vuforia.com/forum/cloud-recognition/questions-php-developers

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:32pm #10

i successfully completed the insert marker image and metadata packages image and text and video link also using php , but when i update the same target image and metadata package, its problem to me so give some ideas and sample code...and references

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:26pm #9

hi masters,

give some sample php code for update the target image and metadata package in cloud database

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:18pm #8

hi to all

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 1:03pm #7

           i used this below code but not working for me

 

           $target_id = '19c6a894f8bb4c079bff5a8739423c79';//hot code value for target id
            $metadata_url = "testacc.in";
            $img_url12 = "http://www.icvme.com/v/smurf.jpg";
            $testupdate = $this->UpdateData($img_url12, $metadata_url, $target_id);
             print_r($testupdate);

 

public function UpdateData($img_url12, $metadata_url, $target_id){
        $b64_img = file_get_contents($img_url);
        $image = base64_encode($b64_img);
        $getmetadata = file_get_contents($metadata_url);
        $metadata = base64_encode($getmetadata);
    
        $arr = array("name"=>"22202","width"=>300,"image"=>$image , "active_flag" => 1,"application_metadata"=>$metadata);
        $content = json_encode($arr);
    
        //$credentials = createSignature("/targets/$target_id", "PUT", "application/json", $content);
        $credentials = $this->createSignature1("/targets/$target_id", "PUT", "application/json", $content);
        //$credentials = $this->createSignature("/targets/$target_id", "POST", "application/json", $content);
        $target = "https://vws.vuforia.com/targets/$target_id";
    
        return $this->updateTarget($credentials, $target, $content);
    } //UpData($img_url, $metadata_url, $target_id)

 

public function createSignature1($requestPath, $postType = "GET", $contentType = "", $content = ""){
        //$serveraccesskey='5cf7eee558a516f88dafdbde9712bbd3f3747402';
        //$serversecretkey='95ece0b08503766773e9044c0cf4e94f541e13d7';
        $baseUrl     = Zend_Controller_Front::getInstance()->getBaseUrl();
        $serveraccess_key = Zend_Registry::get('config')->constants->serveraccesskey;
        $serversecret_key = Zend_Registry::get('config')->constants->serversecretkey;
        $vuforia_dateformat1 = Zend_Registry::get('config')->constants->vuforiadateformat;
        $serveraccesskey = $serveraccess_key;
        $serversecretkey = $serversecret_key;
        $contentMD5 = md5($content);
        $date = new DateTime("now", new DateTimeZone("GMT"));
        $stringToSign = $postType . "\n" . $contentMD5 . "\n" . $contentType . "\n" . $date->format($vuforia_dateformat1) . " GMT\n" . $requestPath;
        $signature = $this->hexToBase64(hash_hmac('sha1', $stringToSign, $serversecretkey));
        $credentials = $serveraccesskey.":".$signature;
        return $credentials;
    }//createSignature()

 

 

public function updateTarget($credentials, $target, $data){
        $date = new DateTime("now", new DateTimeZone("GMT"));
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $target);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_VERBOSE, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Date: ' .$date->format("D, d M Y H:i:s"). " GMT", 'Content-Type: application/json', 'Authorization: VWS ' .$credentials));
        $json = curl_exec($ch);
        curl_close($ch);
        return $json;
  } //updateTarget($credentials, $target, $data)

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:58pm #6

hi no response just simple the page loading and show the design of update page

 

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:57pm #5

o

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:56pm #4

What is the response that you are getting from the Cloud Reco service? - what is the message that the server returning?

Also please post to the VWS forum so that we can track your question.

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:55pm #3

karthikeyan987 wrote:

Hi,

     i am work with vuforia AR . its nice, but i have some problem when  update the target image and metadata package in cloud database using php. how to solve this problem?, kindly help to me, and then i already used some code from vuforia developer site refernce, and search with google also  and i implemented some code but not  use , in this page (  https://developer.vuforia.com/forum/cloud-recognition/questions-php-developers  ) same like that issues so i refer it but no use, so i need some guidence.Thanks in advance

UPDATE TARGET IMAGE AND META DATA USING PHP CODE

May 13, 2013 - 12:47pm #2

hi masters any one if u see my post reply me

Log in or register to post comments