Menu

Images in table cell

2005-08-02
2012-12-19
  • Kristian Herpel

    Kristian Herpel - 2005-08-02

    Hello,

    i've added support for images in table cells. You can download an example pdf file at http://www.hexperience.de/pdf/pdftest.pdf .

    The source code is available at http://www.hexperience.de/pdf/pdfImagesInTables.tar.gz . The archive contains all required files to test the extension, just run the pdftest.php.

    To use the extension in your r&os pdf installation just copy the changed class.ezpdf.php over the existing file. I did not change the class.pdf.php.

    Usage: Just add <C:showimage:{ABSOLUTE FILENAME}> to your table data.

    Its possible to specify the maximum width and height:

    <C:showimage:{file} 90> scales the image, if the image width is greater than 90px.

    <C:showimage:{file} 0 90> scales the image, if the image height is greater than 90px.

    <C:showimage:{file} 90 90> scales the image, if the image height or the image width are greater than 90px.

    Kristian

     
    • rkt

      rkt - 2005-09-14

      Hi Kristian,

      I downloaded the modified classes and tried your test program on Apache 1.3.28 running on my local Windows XP PC. I did not get the desired O/P. On Mozilla Firefox browser, I get Abode Acrobat alert message: File does not begin with '%PDF-'. Wehn I run the same program in IE, I get error message:
      Warning: getimagesize(c:\program) [function.getimagesize]: failed to open stream: No such file or directory in c:\program files\apache group\Apache\htdocs\class.ezpdf.php on line 740

      Do you have any idea why it is not working on my PC?

      Thanks.

      - Ravi

       
      • Kristian Herpel

        Kristian Herpel - 2005-09-14

        Hello Ravi,

        did you use the pdftest.php file from the archive? If it didn't work with this file, could you please change the path in the table data from getcwd() to the absolute path on your installation, e.g.:

        $data = array(
        array('num'=>1,'name'=>'gandalf','type'=>'<C:showimage:c:/mywebsite/cartman.jpg 90>'),
        );

        The getcwd() command might not work correctly on windows, so this change may help. Please send me a mail, if you still get the error message.

        Thanks,
        Kristian

         
    • rkt

      rkt - 2005-09-15

      Kristan, Thanks for your help.

      Changing getcwd() to absolute path helped, almost!
      When I changed getcwd() to absolute path, it still did not work, e.g.
      $data = array(
                          array('num'=>1,'name'=>'gandalf','type'=>'<C:showimage:C:\Program Files\Apache Group\Apache\htdocs\cartman.jpg 90>'),

      did not work. However, changing it relative to the server root path helped, i.e.
      $data = array(
                          array('num'=>1,'name'=>'gandalf','type'=>'<C:showimage:cartman.jpg 90>'), 
      works. I think, spaces in my path may have something to do with this.
      Thanks again for your help.

       
    • Mark Miller

      Mark Miller - 2006-04-24

      Hello Kristan, i am using your code and it is working ok. but in Showimage when i put the full path of the image it is not displaying image. Ex. http://www.domain.com/images/logo.jpeg then it is not displaying image but if i change it too ./images/logo.jpeg then it works. Can u pls help me so that i can show the image with full url. Thanx in advance.

       
    • maxmax

      maxmax - 2006-05-01

      Il tuo sistema è veramente OK !!! Bravissimo !!!
      E grazie per la tua disponibilità: la funzione <C:showimage:{ABSOLUTE FILENAME}> funziona benissimo.
      Complimenti.
      Thanks from Italy

       
      • tk_

        tk_ - 2006-05-01

        Please write your article in english - this ist the usually used language here

        greetings,
        Tobias

         
    • Kristian Herpel

      Kristian Herpel - 2006-05-16

      Sorry Mark and rktaxalifor not answering your messages for such a long time but finally I've got some time to work on this extension.
      The new version can be downloaded from http://www.hexperience.de/pdf/pdfimagesintable_1.1.tar.gz .

      @rktaxali: The cause of the error was the whitespace in the filename (Program Files) but it's fixed (sort of :-) ) in the updated version. All filenames with whitespaces needs to be urlencoded, e.g. '<C:showimage:'.urlencode('C:/Program Files/Apache Group/...').' 90>' .

      @Mark: The updated version supports urls as filenames in the showimage tag. The url needs to be urlencoded too, e.g. '<C:showimage:'.urlencode('http://www.mydomain.mytld/myimage.png').' 90>' . In order to use an url as the filename you must activate the gd or gd2 extension for php.

      Kristian

       
    • Jim Welch

      Jim Welch - 2006-09-07

      I have installed and I get a nice rectangle of the correct size inplace of the image, the second column (text) works fine. Using ezImage direct works fine. I've tried urlencode, same results.
            $mystuff[]=array('left'=>'<C:showimage:./images/files/Band_Logo_Color_0100.jpg>','right'=>$ltitle. "\n\n" . $when);
      $options = array('xOrientation'=>'right', 'xPos'=>'left', 'showHeadings'=>0, 'showLines'=>0);
      $pdf->ezTable($mystuff,"","", $options);

       
      • Kristian Herpel

        Kristian Herpel - 2006-09-13

        Sorry for my late answer, but I haven't checked the forum responses for some time...

        I've tested the file name parameters from your example on my local apache+php installation with windows xp and it worked without a problem. Did you use the updated version or the old one?

        Could you please send me a mail with information about the php version and operation system you are using? There might also be a problem with the picture, could you send this file too so that I can check it on my local installation?

        Thanks,
        Kristian

         
    • Scito

      Scito - 2006-09-14

      Hey Kristian, I just sent you an e-mail about an issue I have as well, hope it's the right mail address (the 1 from the PHP file)

       
    • Mark Rogers

      Mark Rogers - 2006-10-04

      Kristian,

      Have you taken your files down from your website? I can't see them there any more.

       
    • UntolStories

      UntolStories - 2008-02-12

      An easier method to using file names with spaces is to change the code to be comma delimited instead of using spaces. This is done easily by changing

      $imagetag = '<C:showimage:'.$params->getFilename().' '.round($width).' '.round($height).' '.$currenty.'>'; // line 242

      to

      $imagetag = '<C:showimage:'.$params->getFilename().', '.round($width).', '.round($height).', '.$currenty.'>';

      and

      $params = explode(" ", $param);  // line 388

      to

      $params = explode(",", $param);

      I had to do this because even using urlencode it was not processing images correctly. This might have been solved by using rawurlencode.. but i never bothered to try.

       
    • Anonymous

      Anonymous - 2008-03-03

      Hello all,
      It seems the address for the source code (http://www.hexperience.de/pdf/pdfImagesInTables.tar.gz) is down and I can't retrieve the file. Does anybody has the new address? (If sombebody could just email the tar file to me at jcvasquez07@users.sourceforge.net I'll really appreciate it).

      Thanks,

      JC

       
    • headalien

      headalien - 2009-05-17

      to download updated version, remove . (dot) from end of url

       
  • Ole K

    Ole K - 2012-12-19

    Dear Kristian Herpel.
    Thank you for this nice extension.

    We will put your code on http://pdf-php.sourceforge.net/index.php/extensions.html.
    Our new web presentation to R&OS pdf class

     

Log in to post a comment.