__SQL_GET_STRING(image_format,"select format from co_%s_%s
where id=%d",par_area,par_class,par_id)
// can convert only from bmp format
if (!strcmp(image_format,"bmp"))
{
@co_call(par_area,par_class,'getPath',par_id=>par_id,par_area=>par_area,par_class=>par_class);
partial_path = cou_getReturnValue( cnx, CO_STRING, &err);
source_file_path = ap_psprintf( p, "%s/%s", cou_getCODataPath(), partial_path);
destination_file_path = ap_psprintf( p, "/tmp/picture.%d", par_id);
bash_command = ap_psprintf(p,"%stoppm %s | ppmtogif > %s",image_format,source_file_path,destination_file_path);
system(bash_command);
__CREATE_QUERY("update co_%s_%s set format='gif'
where id=%d",par_area,par_class,par_id)
__SQL_EXEC
@co_call(par_area,par_class,'getPath',par_id=>par_id,par_area=>par_area,par_class=>par_class);
partial_path = cou_getReturnValue( cnx, CO_STRING, &err);
source_file_path = ap_psprintf( p, "%s/%s", cou_getCODataPath(), partial_path);
rename(destination_file_path,source_file_path);
}