グラデーション方法のサンプル how to create thumbnail + shadow by this script
/* offset of drop shadow from top left */
define ( "DS_OFFSET" , 5 );
/* number of steps from black to background color /*
define("DS_STEPS", 10);
/* distance between steps */
define ( "DS_SPREAD" , 1 );
/* define the background color */
$background = array( "r" => 255 , "g" => 255 , "b" => 255 );
// 元のサイズに対して、影のサイズを含めた新しい幅と高さを決定します
$width = $o_width + DS_OFFSET ;
$height = $o_height + DS_OFFSET ;
$image = imagecreatetruecolor ( $width , $height );
/* determine the offset between colors */
$step_offset = array( "r" => ( $background [ "r" ] / DS_STEPS ), "g" => ( $background [ "g" ] / DS_STEPS ), "b" => ( $background [ "b" ] / DS_STEPS ));
/* calculate and allocate the needed colors */
$current_color = $background ;
for ( $i = 0 ; $i <= DS_STEPS ; $i ++) {
$colors [ $i ] = imagecolorallocate ( $image , round ( $current_color [ "r" ]), round ( $current_color [ "g" ]), round ( $current_color [ "b" ]));
$current_color [ "r" ] -= $step_offset [ "r" ];
$current_color [ "g" ] -= $step_offset [ "g" ];
$current_color [ "b" ] -= $step_offset [ "b" ];
}
// 一番外側の四角
imagefilledrectangle ( $image , 0 , 0 , $width , $height , $colors [ 0 ]);
// だんだん小さく、色を濃く
for ( $i = 0 ; $i < count ( $colors ); $i ++) {
imagefilledrectangle ( $image , DS_OFFSET , DS_OFFSET , $width , $height , $colors [ $i ]);
$width -= DS_SPREAD ;
$height -= DS_SPREAD ;
}
ボックスをすこしづづ小さく薄く描画して、最終的には、imageconvolution でガウス分布のぼかしを実行しています( ガウス分布のぼかしは、マニュアルのサンプルにあります )
<?php $image = imagecreatetruecolor(180,40); imagestring($image, 5, 10, 8, 'Gaussian Blur Text', 0x00ff00); $gaussian = array( array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0) ); imageconvolution($image, $gaussian, 16, 0);
タグ:gd











確認用簡易ダンプ
DOM を使用したコード
PHP : GD で Windows のビットマップを扱う
※ エキスパートモードで表示しています
アーカイブとカテゴリページはこのように簡単に設定できますが、タグページは HTML 設定を直接変更して、以下の『タグページでのみ表示される内容』の記述方法で設定する必要があります


















