Trouble inserting images (from blob mysql) in worksheet

Topics: User Forum
Dec 15, 2010 at 5:10 AM
Edited Dec 19, 2010 at 9:56 AM


I need to produce an excel file with data from mysql 

There is name , id code, email and a picture which is store in a blob in mysql

problem is that i cannot use a setpath that change with every entry of the bd. so i get a file without image when i get a file. 

so in my script, when i use $lien to set info inside setpath($lien), nothing goes out, if i change it for  setpath('portrait.jpg') it's work but every time with the same image which isn't what  i need, image need to be different for each entry....  

here is the code :

//---- r�cup�ration des �tudiants ayant fait le choix de cette activit� ----// 
$sql2 = "SELECT * FROM participants WHERE code_act='$act' AND  code_semestre='S11011' ORDER BY ASC" ; 
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error());
//---- Affichage des informations ----//
for($e = 0 ; $e < mysql_num_rows($req2) ; $e++) {
$row2 = mysql_fetch_assoc($req2);
$id = $row2['identifiant'];
$sql3 = "SELECT * FROM tmp_ETU_A_JOUR WHERE COD_ETU='$id' "; 
$req3 = mysql_query($sql3); 
$row3 = mysql_fetch_assoc($req3); 
$nom = utf8_encode($row3['LIB_NOM_PAT_IND']);
$prenom = utf8_encode($row3['LIB_PR1_IND']);
$mel = $row3['MAIL_UVSQ'];
$sexe = $row3['COD_SEX_ETU'];
$img = $row3['IMG_ETU'];
$image = imagecreatefromstring($img);
$temp = tmpfile(); 
$lien ='trombi/'.$id.'.jpg';
imagejpeg($image, $lien, '100');
$ligne = $e+1;
$B= 'B'.$ligne;
$C= 'C'.$ligne;
$D= 'D'.$ligne;
$E= 'E'.$ligne;
$F= 'F'.$ligne;
$G= 'G'.$ligne;
$objDrawing = new PHPExcel_Worksheet_Drawing();
/*$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();


hop you can help me