Reads an image for later placement

- « ps_open_image_file

- ps_open_memory_image »

- PHP Manual
- PS Functions
- Reads an image for later placement

# ps_open_image

(PECL ps >= 1.1.0)

ps_open_image — Reads an image for later placement

### Description

ps_open_image(
resource `$psdoc`,
string `$type`,
string `$source`,
string `$data`,
int `$lenght`,
int `$width`,
int `$height`,
int `$components`,
int `$bpc`,
string `$params`
): int

Reads an image which is already available in memory. The parameter `source` is currently not evaluated and assumed to be `memory`. The image data is a sequence of pixels starting in th upper left corner and ending in the lower right corner. Each pixel consists of `components` color components, and each component has `bpc` bits.

### Parameters

`psdoc`

  Resource identifier of the postscript file as returned by ps_new().

`type`

  The type of the image. Possible values are `png`, `jpeg`, or `eps`.

`source`

  Not used.

`data`

  The image data.

`length`

  The length of the image data.

`width`

  The width of the image.

`height`

  The height of the image.

`components`

  The number of components for each pixel. This can be 1 (gray scale images), 3 (rgb images), or 4 (cmyk, rgba images).

`bpc`

  Number of bits per component (quite often 8).

`params`

### Return Values

Returns identifier of image or zero in case of an error. The identifier is a positive number greater than 0.

### See Also

- ps_open_image_file() - Opens image from file
- ps_place_image() - Places image on the page
- ps_close_image() - Closes image and frees memory