Announcement

Collapse
No announcement yet.

Image path ????

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Image path ????

    Hello,

    I have a field (image(File Name) that uploads images to the folder path (scriptcase8\file\img\Company_Logos).

    This works well and I see the uploaded images in that folder.

    Now...

    I'm trying to load a company logo image into the header of pages based on the login credentials of the user.

    I use the following code to retrieve the correct company logo image and it retrieves the right logo but displaying to the header always fails with a broken path????

    In "Layout", "Header & Footer" I have "NM_LOGOTIPO" set as "Image" with a value of "[myimage]".

    Can anyone shed some light on why this path is not working?



    sc_lookup(dataset, "select company, image_path from tb_companies where companyID = '[usr_company]' order by company" );
    $result1 = {dataset[0][0]};
    $result2 = {dataset[0][1]};

    [myimage] = "../../../file/img/Company_Logos/".$result2;

    #test to see if the image will display.
    echo '<img src="data:image/png;base64,' . base64_encode( [myimage] ) . '" />';

  • #2
    [myimage] = "../../../file/img/Company_Logos/".$result2;

    #test to see if the image will display.
    echo '<img src="data:image/png;base64,' . base64_encode( [myimage] ) . '" />';
    base64_encode does encode a string, not a file. You must read the file first.
    Try this one instead

    [myimage] = file_get_contents("../../../file/img/Company_Logos/".$result2);

    #test to see if the image will display.
    echo '<img src="data:image/png;base64,' . base64_encode( [myimage] ) . '" />';

    jsb

    Comment


    • #3
      Awesome JSB!

      That work perfectly!!!

      Thanks!!!

      Comment


      • #4
        Hello jsbinca,

        I have also tried and it works with echo ...
        But what I have to insert in the scriptcase header line 1 with image? only the [myimage] variable does not work.

        Thank you for your help
        Wilfried

        Comment

        Working...
        X