Perlで画像の縦横サイズを取得
Perlで画像の縦横サイズを簡単に取得できるモジュール Image::Size - heavy monologue
use Image::Size; my ($width, $height) = imgsize($data); my ($width, $height) = imgsize($fh);
File::Path
File::Path - 複数階層のディレクトリの作成と削除
use File::Path qw/mkpath rmtree/; @created = mkpath $dir; @created = mkpath($dir, 0, 0644); # 第二引数は標準出力するかどうか $removed = rmtree $dir;
sysreadを用いて画像読み込み
open my $fh '<', $file_name or die "Can't read the file."; my $image_data = ''; while (sysread($fh, my $buf, 1024)) { $image_data .= $buf; } close($fh);
ファイルの最終更新日でソート、フォーマットを変換
@file_list = sort { (stat($b))[9] cmp (stat($a))[9] } @file_list; my $date = POSIX::strftime("%Y%m%d", localtime((stat($path))[9]));