09-16-2019, 04:22 PM
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:
let us know how it goes
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
TSolucio