### Navigation

- index
- next |
- previous |
- PHPRtfLite v1.x documentation »

# Images

In PHPRtfLite you can add images to headers and footers, to table cells, and sections.

## Image resize

You can specify the width and the height of the image in the RTF document. Note, that adding large images will cause large RTF documents, even if the images is scaled down by RTF.

    <?php
    $imageFile = '/path/to/image/file';
    $image = $section->addImage($imageFile);
    // width to 1cm
    $image->setWidth(1);
    // height to 1cm
    $image->setHeight(1);

## Image border

    <?php
    $border = new PHPRtfLite_Border(
        $rtf,                                       // PHPRtfLite instance
        new PHPRtfLite_Border_Format(2, '#00FF00'), // left border: 2pt, green color
        new PHPRtfLite_Border_Format(1, '#FFFF00'), // top border: 1pt, yellow color
        new PHPRtfLite_Border_Format(2, '#FF0000'), // right border: 2pt, red color
        new PHPRtfLite_Border_Format(1, '#0000FF')  // bottom border: 1pt, blue color
    );
    // image with border
    $image->setBorder($border);

Read more about creating borders here: Borders.

### Navigation

- index
- next |
- previous |
- PHPRtfLite v1.x documentation »