image() public méthode

The upper-left corner and at least one of the dimensions must be specified; the height or the width can be calculated automatically in order to keep the image proportions. Supported formats are JPEG and PNG. All coordinates can be negative to provide values from the right or bottom edge of the page (since File_Pdf 0.2.0, Horde 3.2). For JPEG, all flavors are allowed: - gray scales - true colors (24 bits) - CMYK (32 bits) For PNG, are allowed: - gray scales on at most 8 bits (256 levels) - indexed colors - true colors (24 bits) but are not supported: - Interlacing - Alpha channel If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above). The format can be specified explicitly or inferred from the file extension. It is possible to put a link on the image. Remark: if an image is used several times, only one copy will be embedded in the file.
See also: addLink()
public image ( string $file, float $x, float $y, float $width, float $height, string $type = '', mixed $link = '' )
$file string Name of the file containing the image.
$x float Abscissa of the upper-left corner.
$y float Ordinate of the upper-left corner.
$width float Width of the image in the page. If equal to zero, it is automatically calculated to keep the original proportions.
$height float Height of the image in the page. If not specified or equal to zero, it is automatically calculated to keep the original proportions.
$type string Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
$link mixed URL or identifier returned by {@link addLink()}.
Exemple #1
0
 /**
  * Horde Bug #5964
  */
 public function testLinks()
 {
     $pdf = new Horde_Pdf_Writer(array('orientation' => 'P', 'format' => 'A4'));
     $pdf->setInfo('CreationDate', $this->fixtureCreationDate());
     $pdf->open();
     $pdf->setCompression(false);
     $pdf->addPage();
     $pdf->setFont('Helvetica', 'U', 12);
     $pdf->write(15, 'Horde', 'http://www.horde.org');
     $pdf->write(15, "\n");
     $link = $pdf->addLink();
     $pdf->write(15, 'here', $link);
     $pdf->addPage();
     $pdf->setLink($link);
     $pdf->image(__DIR__ . '/fixtures/horde-power1.png', 15, 15, 0, 0, '', 'http://pear.horde.org/');
     $actual = $pdf->getOutput();
     $expected = $this->fixture('links');
     $this->assertEquals($expected, $actual);
 }