0
私はhttp://wideimage.sourceforge.net/をPHPで使用しています。私は約50%で透明になる画像にテキストを書きたいと思います。出来ますか?wideImage libを使用した透過テキストですか?
私はhttp://wideimage.sourceforge.net/をPHPで使用しています。私は約50%で透明になる画像にテキストを書きたいと思います。出来ますか?wideImage libを使用した透過テキストですか?
はい、それは可能ですが、画像のTrueColorのバージョンを取得する必要があります:
$image = $image->asTrueColor();
それが完了したら、あなたは、単に50%のアルファ透明度を使用してテキストを書くために次の操作を行うことができます。
http://wideimage.sourceforge.net/wp-content/current/:このためのカスタム操作を定義する必要はありません$color = $image->allocateColorAlpha(255, 255, 255, 63);
$canvas = $image->getCanvas();
$canvas->useFont('path/to/font.ttf', 16, $color);
$canvas->writeText('right', 'bottom', 'Hello, world!');
Thxをたくさん、ヨーロッパからの歓声:) – joshua
、WideImage_TrueColorPaletteはすでにallocateColorAlpha()メソッドを持っていますdoc/WideImage/WideImage_TrueColorImage.html#methodallocateColまたはアルファ この例は正しくあります。 –
@gasper_k: 'WideImage_TrueColorImage'を忘れました。変更されました。 –