
画像ファイルを取り込む
	$img = imagecreatefrompng("imori.png");
	var_dump($img);
	imagedestroy($img); // 破棄
object(GdImage)#1 (0) {
}
取り込んだ画像からサイズを取得する
	$img = imagecreatefrompng("imori.png");
	$sx = imagesx($img);
	$sy = imagesy($img);
	imagedestroy($img);
	
int(320)
int(180)
別名で保存する
imagepngでimageオブジェクトを画像ファイルとして保存する。
	$img = imagecreatefrompng("imori.png");
	
	// 楕円を描画
	$col_ellipse = imagecolorallocate($img, 255, 255, 255);
	imageellipse($img, 200, 150, 300, 200, $col_ellipse);
	
	// 別名で保存
	imagepng( $img, "imori2.png");
	imagedestroy($img);
 
空画像を作成してファイル保存する
// 空の画像を作成する $img = imagecreatetruecolor(200, 160); // 楕円の色を選択しますRGB $col = imagecolorallocate($img, 44,168,108); imageellipse($img, 50, 50, 60, 60, $col); // 画像を出力します imagepng( $img, "test1.png"); imagedestroy($img);
 
	$ret = getimagesize('imori.png');
	var_dump($ret);
array(6) {
  [0]=>
  int(320)
  [1]=>
  int(180)
  [2]=>
  int(3)
  [3]=>
  string(24) "width="320" height="180""
  ["bits"]=>
  int(8)
  ["mime"]=>
  string(9) "image/png"
}
画像の文字列データから画像の大きさを取得する
	$data = file_get_contents('imori.png');// 文字列データとして取得
	$ret = getimagesizefromstring($data); // 文字列データから情報を取得する
	var_dump($ret);
array(6) {
  [0]=>
  int(320)
  [1]=>
  int(180)
  [2]=>
  int(3)
  [3]=>
  string(24) "width="320" height="180""
  ["bits"]=>
  int(8)
  ["mime"]=>
  string(9) "image/png"
}