1 <?php 2 error_reporting(E_ALL); 3 require_once ('soapclient/SforcePartnerClient.php'); 4 require_once('connection.php'); 5 6 $ids = array(); 7 $ids[] = '00390000006IUVK'; 8 $ids[] = '00390000001lwbd'; 9 getPhotos($ids); 10 11 12 function getPhotos($contactids){ 13 $mySforceConnection = getConnection(); 14 $query = "SELECT Id, Name from Attachment Where ParentId in ("; 15 foreach($contactids as $id){ 16 $query .= "'". $id . "',"; 17 } 18 $query = substr($query , 0, strlen($query) - 1); 19 $query .= ")"; 20 $queryResult = $mySforceConnection->query($query); 21 22 $records = $queryResult->records; 23 if(count($records) > 0){ 24 echo "<table cellspacing='5' cellpadding='5'><tr>"; 25 foreach($records as $rec){ 26 echo "<td style='text-align:center;font-size:12px;'>". 27 "<img src='image.php?id=".$rec->Id."' ". 28 "style='width:200px;height:200px;border:1px solid #ccc;padding:10px'/> <br/>" 29 . $rec->fields->Name. 30 "</td>"; 31 } 32 echo "</table>"; 33 } 34 return NULL; 35 } 36 ?>