Trim::setImage
元の画像と出力先のパスを設定します
説明
public void Trim::setImage( string $org_path, string $cnv_path )
元の画像を読み込みます。出力形式は$cnv_pathの拡張子(jpgまたはjpeg、png、gif)で決まります。JPEGの写真は、Exifの向きの情報に合わせて回転します。
次の場合は\RuntimeExceptionを投げます。
$org_pathがファイルでない。$cnv_pathの拡張子がjpg、jpeg、png、gifのどれでもない。$org_pathがJPEG、PNG、GIFの画像でない、または読み込めない。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $org_path | string | 元の画像のパス | |
| $cnv_path | string | 出力する画像のパス(.jpg、.jpeg、.png、.gif) |
例
Controller
use Fegg\Tool\Trim;
$trim = new Trim();
try {
$trim->setImage('path/to/image.jpg', 'path/to/converted.jpg');
} catch (\RuntimeException $e) {
// missing file, not an image, or another output type
}