Skip to content

Instantly share code, notes, and snippets.

@kamichimo
Created October 31, 2014 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamichimo/af6c062f81c4397e4318 to your computer and use it in GitHub Desktop.
Save kamichimo/af6c062f81c4397e4318 to your computer and use it in GitHub Desktop.
PHPで画像サイズを取得する
$imagesize = getimagesize('画像のURL');
if($imagesize){
echo $imagesize[0]; // width
echo $imagesize[1]; //height
echo $imagesize[2]; //画像の種類
echo $imagesize[3]; //サイズの文字列(width="X" height="Y")
}else{
echo 'データ取得失敗...';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment