Reputation: 9
Hello every one i m using fpdf libray to creat pdf files from html form.
i m using
$pdf->Image('C:/DOCUME%7E1/mypic.PNG',60,140,120,0,'','');
to display image on pdf.
in its first parameter it asks for exact path.it doesn't accept anyaddress variable here. but i want to make dynamic.i have able to get a complete path in an variable.
i have printed this variable.
//////////////////////////////
echo "$path";
output
////////////////////
C:/DOCUME%7E1/mypic.PNG
/////////////////////////////////////////////////////
but how i put that path from variable in this parameter.? when i use this variable as in this function.it give error.
$pdf->Image('$path',60,140,120,0,'','');
plz help me for this.
Upvotes: 0
Views: 511
Reputation: 630
$pdf->Image($path,60,140,120,0,'','');
This should work. I removed the single quotes from the variable.
OR
put the $path
in double quotes:-
$pdf->Image("$path",60,140,120,0,'','');
Upvotes: 3
Reputation: 490183
Remove the single quotes wrapping the variable name.
The single quotes make PHP treat your string as a literal (i.e. $path
instead of C:/DOCUME%7E1/mypic.PNG
).
Confusingly, it would work with double quotes because of variable interpolation.
Upvotes: 1