Graphics Php

#!/usr/bin/php -q
$image_types=array(
'',
'GIF','JPG','PNG','SWF','PSD',
'BMP','TIFF(intel byte order)',
'TIFF(motorola byte order)',
'JPC','JP2','JPX','JB2','SWC',
'IFF'
);
$PHP_SELF=basename($argv[0]);
for($i=1;$i if(substr($argv[$i],0,1)=='/'){
$f=$argv[$i];
}else{
$f=$_ENV["PWD"].'/'.$argv[$i];
}
$name=$argv[$i];
if( !$f || in_array($f, array('--help', '-help', '-h', '-?')) ){
// show help msg
echo "Get size of image\n";
echo "Usage: $PHP_SELF [image]\n\n";
}elseif(!is_file($f)){
//dont process if not a file
echo "\"$f\" not a file\n";
}else{
$dim=getimagesize($f);
if(!$dim){
echo "$name not handled";
}else{
echo "$name {$dim[0]}x{$dim[1]} {$image_types[$dim[2]]}";
}
echo"\n";
}
}
?>