ps_place_image

(PECL ps >= 1.1.0)

ps_place_image画像をページに配置する

説明

ps_place_image(
    resource $psdoc,
    int $imageid,
    float $x,
    float $y,
    float $scale
): bool

以前に読み込まれている画像をページに配置します。画像の縮尺は変更できます。 画像を回転させる場合は、事前に ps_rotate() で座標系を回転させておきます。

パラメータ

psdoc

ps_new() が返す、postscript ファイルのリソース ID。

imageid

ps_open_image() あるいは ps_open_image_file() が返す、 画像のリソース ID。

x

画像の左下角の x 座標。

y

画像の左下角の y 座標。

scale

画像の拡大率。1.0 を指定すると、解像度は 72 dpi となります。 これにより、各ピクセルが 1 ポイントと等しくなるからです。

戻り値

成功した場合に true を、失敗した場合に false を返します。

参考

add a note add a note

User Contributed Notes 2 notes

up
1
mike at lasaero dot com
16 years ago
To get png images to work I had to save them as indexed colour (128 colours).
up
0
php at catchall dot toao dot net
14 years ago
If you want to make a template with graphics software and place it on your PostScript page, one way to do it is with an eps file.

<?php
$template
= ps_open_image_file($ps, 'eps', 'template.eps');
ps_place_image($ps, $template, 0, 0, 1);
?>

Professional page layout software such as InDesign will typically be able to generate an eps file.  If your software can't, one way to do it (on Windows) is to set up a printer that prints to file with the driver "Lexmark Color 4079 plus PS".  This driver is included with Windows and has the option in its advanced preferences to generate an EPS file.
To Top