convert

指定した大きさの真ん中に任意の画像を配置

#pre{{
function createImage($org_file, $width, $height) {
$size = getimagesize($org_file);
$e_org_file = escapeshellarg($org_file);
$in_width = $width * 0.8;
$in_height = $height * 0.8;

$command = "convert -thumbnail {$in_width}x{$in_height} jpg:{$e_org_file} jpg:- | "
."convert -size {$width}x{$height} xc:white jpg:- -gravity center -composite jpg:-";
header("Content-type: image/jpeg");
passthru($command);
}
}}


Last-modified: 2016-07-10 (日) 02:00:26 (742d)