サムネイル画像の作成とその画像の縁取りをしてみました。
<?php
$url = "http://hogehoge/hoge.jpg";
$outfile = "./image/" md5( $url ) . ".jpg";
$w_new = 127;
$h_new = 60;
$size = getimagesize( $url );
$w_src = $size[0];
$h_src = $size[1];
if( $size['mime'] == "image/gif" ){
$im_src = imagecreatefromgif( $url );
}elseif( $size['mime'] == "image/jpeg" ){
$im_src = imagecreatefromjpeg( $url );
}elseif( $size['mime'] == "image/png" ){
$im_src = imagecreatefrompng( $url );
}else{
exit;
}
$hiritu = $h_src * ( $w_new / $w_src );
$im_new = @imagecreatetruecolor ( $w_new, $h_new ) or die ("Cannot Initialize new GD image stream");
imagecolorallocate($im_new, 255,255,255);
imagecopyresampled ( $im_new , $im_src , 0 , 0 , 0 , 0 + intval( $h_new / 1.8 ), $w_new , $hiritu , $w_src , $h_src );
imagesetthickness($im_new , 10);
$col_poly = imagecolorallocate($im_new, 255, 255, 255);
imagepolygon($im_new,
array (
0, 0,
0, $h_new,
$w_new, $h_new,
$w_new, 0
),
4,
$col_poly);
imagesetthickness($im_new , 2);
$col_poly = imagecolorallocate($im_new, 255, 35, 195);
imagepolygon($im_new,
array (
0, 0,
0, $h_new,
$w_new, $h_new,
$w_new, 0
),
4,
$col_poly);
imagejpeg( $im_new , $outfile );
header("Content-type: image/jpeg");
imagejpeg( $im_new );
exit;
?>