use DBI; # 要 DBD::MySQL
#!/usr/bin/perl
use DBI;
$TABLE_NAME = 'テーブル名';
$DB = DBI->connect(...);
my $sth = $DB->prepare(qq|INSERT INTO $TABLE_NAME (
`id`,
`mimetype`,
`object`,
`created`,
`updated`
)
VALUES (?, ?, ?, ?, ?)|
);
$sth->execute(
$id,
$miemetype,
$object,
$NOW,
$NOW
);
$DB->disconnect();
1;
use DBI; # 要 DBD::MySQL
#!/usr/bin/perl
use DBI;
$TABLE_NAME = 'テーブル名';
$DB = DBI->connect(...);
my $sth = $DB->prepare(qq|INSERT INTO $TABLE_NAME (
`id`,
`mimetype`,
`object`,
`created`,
`updated`
)
VALUES (?, ?, ?, ?, ?)|
);
$sth->execute(
$id,
$miemetype,
$object,
$NOW,
$NOW
);
$DB->disconnect();
1;
use GD;
#!/usr/bin/perl
use GD;
open (OLD, "original.jpg") || die "cannot open mayon.jpg¥n";
$oldImage = newFromJpeg GD::Image(¥*OLD) || "Cannot make old image object¥n";
@bound = $oldImage->getBounds();
print "original width: $bound[0] original height: $bound[1] ¥n";
$newImage = new GD::Image(40, 40) || die "cannot make new image object¥n";
$newImage->copyResized($oldImage, 0, 0, 0, 0, 40, 40, $bound[0], $bound[1]);
open NEW, ">nail.jpg";
binmode NEW;
print NEW $newImage->jpeg;
close OLD;
close NEW;
1;
use GD;
#!/usr/bin/perl
use GD;
open (OLD, "original.jpg") || die "cannot open mayon.jpg¥n";
$oldImage = newFromJpeg GD::Image(¥*OLD) || "Cannot make old image object¥n";
@bound = $oldImage->getBounds();
print "original width: $bound[0] original height: $bound[1] ¥n";
$newImage = new GD::Image(40, 40) || die "cannot make new image object¥n";
$newImage->copyResized($oldImage, 0, 0, 0, 0, 40, 40, $bound[0], $bound[1]);
open NEW, ">nail.jpg";
binmode NEW;
print NEW $newImage->jpeg;
close OLD;
close NEW;
1;