Dispaly image dynamicaly.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Talat Maqsood
    New Member
    • Jan 2011
    • 1

    Dispaly image dynamicaly.

    Hello every one i m using fpdf libray to creat pdf files from html form.

    i m using

    Code:
    $pdf->Image('C:/DOCUME%7E1/mypic.PNG',60,140,120,0,'','');
    to display image on pdf and it works well.


    in its first parameter it asks for exact path.it doesn't accept any address variable here.
    but i want to make dynamic.i have able to get a complete path in an variable.

    i have printed this variable.

    //////////////////////////////
    Code:
    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.
    Code:
    $pdf->Image('$path',60,140,120,0,'','');
    it gives error.
    plz help me for this.
  • HaLo2FrEeEk
    Contributor
    • Feb 2007
    • 404

    #2
    Remove the single quotes from around the variable name:

    $pdf->Image($path,60 ,140,120,0,'',' ');

    Single quotes are taken as literal strings, so variable names won't work inside them. Another way would be to replace the single quotes with double quotes, which will work with variables, but you shouldn't do that because you don't need the quotes at all:

    Code:
    $path = "something";
    echo '$path';
    output:

    $path

    Code:
    $path = "something";
    echo "$path";
    output:

    something

    Code:
    $path = "something";
    echo $path;
    output:

    something.

    No quotes is recommended.

    Comment

    Working...