imagesx

画像の幅を取得する

説明

int imagesx(GdImage $image)

指定した画像オブジェクト image の幅を返します。

パラメータ

image

imagecreatetruecolorのような画像作成関数が返す GdImage オブジェクト。

戻り値

image の幅を返します。

変更履歴

バージョン 説明
8.0.0 image は、 GdImage クラスのインスタンスを期待するようになりました。 これより前のバージョンでは、有効な gd resource が期待されていました。

例1 imagesx の使用法

<?php

// 300*200 の画像を作成します
$img imagecreatetruecolor(300200);

echo 
imagesx($img); // 300

?>

参考

  • imagecreatetruecolor
  • getimagesize
  • imagesy