TCPDF::Image( $file,  $x = '',  $y = '',  $w,  $h,  $type = '',  $link = '',  $align = '',  $resize = false,  $dpi = 300,  $palign = '',  $ismask = false,  $imgmask = false,  $border,  $fitbox = false,  $hidden = false,  $fitonpage = false,  $alt = false,  $altimgs = array() )

Puts an image in the page.


Description Description

The upper-left corner must be given. The dimensions can be specified in different ways:

  • explicit width and height (expressed in user unit)
  • one explicit dimension, the other being calculated automatically in order to keep the original proportions
  • no explicit dimension, in which case the image is put at 72 dpi

Supported formats are JPEG and PNG images whitout GD library and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM; 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.


Parameters Parameters

$file

(Required) (string) Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*<a href="http://www.example.com/image.jpg">http://www.example.com/image.jpg</a>').

$x

(Optional) (float) Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).

Default value: ''

$y

(Optional) (float) Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).

Default value: ''

$w

(Required) (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

$h

(Required) (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

$type

(Optional) (string) Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

Default value: ''

$link

(Optional) (mixed) URL or identifier returned by AddLink().

Default value: ''

$align

(Optional) (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>

Default value: ''

$resize

(Optional) (mixed) If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling).

Default value: false

$dpi

(Optional) (int) dot-per-inch resolution used on resize

Default value: 300

$palign

(Optional) (string) Allows to center or align the image on the current line. Possible values are:<ul><li>L : left align</li><li>C : center</li><li>R : right align</li><li>'' : empty string : left for LTR or right for RTL</li></ul>

Default value: ''

$ismask

(Optional) (boolean) true if this image is a mask, false otherwise

Default value: false

$imgmask

(Optional) (mixed) image object returned by this function or false

Default value: false

$border

(Required) (mixed) Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))

$fitbox

(Optional) (mixed) If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom).

Default value: false

$hidden

(Optional) (boolean) If true do not display the image.

Default value: false

$fitonpage

(Optional) (boolean) If true the image is resized to not exceed page dimensions.

Default value: false

$alt

(Optional) (boolean) If true the image will be added as alternative and not directly printed (the ID of the image will be returned).

Default value: false

$altimgs

(Optional) (array) Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing.

Default value: array()


Top ↑

Return Return

(image) information


Top ↑

Source Source

File: includes/lib/tcpdf/tcpdf.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
1.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.