Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import contacts with picture
#2
The code you reference can't be easier. Notice that in that example it is generating a QR code before saving and that is where all the work is. In your case you want to get the image from the file system and that is where your work is. it would be something like:

PHP Code:
<?php
include_once 'vtlib/Vtiger/Module.php';
require_once 
'include/Webservices/Revise.php';
$current_user Users::getActiveAdminUser();
 
// make a query to get all the contacts you want to update
// for each contact
// get the image from the hard disk into a variable
$data file_get_contents(name of file);
// setup array for update
$model_filename=array(
    
'name'=>'whatever name you want to use' // no slash nor paths in the name
    
'size'=>strlen($data),
    
'type'=>' image/png'// change accordingly
    
'content'=>base64_encode($data)
);

$contactData  = array(
    
'attachments' => array(
        
'imagename' => $model_filename,
    ),
    
'id'=> '29x4062'// put your contact webservice ID here
);
vtws_revise($contactData$current_user);
// end loop 


let us know how it goes
Joe
TSolucio
Reply


Messages In This Thread
Import contacts with picture - addady2 - 09-16-2019, 08:20 AM
RE: Import contacts with picture - joebordes - 09-16-2019, 04:22 PM
RE: Import contacts with picture - addady2 - 09-17-2019, 04:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)