You should destroy the $img too...
So it would be :
$img = @imagecreatefromjpeg("http://www.mysite.com/my_image.jpg");
if ($img) {
$img_height = imagesy($img);
ImageDestroy($img);
}
echo "My height is " . $img_height;
imagesy
(PHP 4, PHP 5)
imagesy — 画像の高さを取得する
説明
int imagesy
( resource
$image
)
指定した画像リソース image の高さを返します。
返り値
image の高さ、あるいはエラー時に FALSE
を返します。
例
例1 imagesy() の使用法
<?php
// 300*200 の画像を作成します
$img = imagecreatetruecolor(300, 200);
echo imagesy($img); // 200
?>
参考
- imagecreatetruecolor() - TrueColor イメージを新規に作成する
- getimagesize() - 画像の大きさを取得する
- imagesx() - 画像の幅を取得する
BSE_Icheb at hotmail dot com
20-Jun-2003 04:13
boo at php dot net
13-Aug-2002 11:01
To use this function notice that 'image' parameter it's a RESOURCE and NOT an Image File Path !
Here comes an exemple:
$img = @imagecreatefromgif("http://www.mysite.com/my_imag.gif");
if ($img) $img_height = imagesy($img);
echo "My height is " . $img_height;
