WebProg 初心者の質問 Part3at PHPWebProg 初心者の質問 Part3 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト812:811 03/06/03 18:19 /P4baUDR Image::Sizeのソースから sub jpegsize { my $stream = shift; my $MARKER = "\xFF"; # Section marker. my $SIZE_FIRST = 0xC0; # Range of segment identifier codes my $SIZE_LAST = 0xC3; # that hold size info. my ($x, $y, $id) = (undef, undef, "could not determine JPEG size"); my ($marker, $code, $length); my $segheader; # Dummy read to skip header ID &$read_in($stream, 2); while (1) { $length = 4; $segheader = &$read_in($stream, $length); # Extract the segment header. ($marker, $code, $length) = unpack("a a n", $segheader); 813:811続き 03/06/03 18:19 /P4baUDR # Verify that it's a valid segment. if ($marker ne $MARKER) { # Was it there? $id = "JPEG marker not found"; last; } elsif ((ord($code) >= $SIZE_FIRST) && (ord($code) <= $SIZE_LAST)) { # Segments that contain size info $length = 5; ($y, $x) = unpack("xnn", &$read_in($stream, $length)); $id = 'JPG'; last; } else { # Dummy read to skip over data &$read_in($stream, ($length - 2)); } } ($x, $y, $id); } 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch