php で画像イメージを作っております。
rhel5 では、正しく表示されていたのが rhel7 で正しく表示されなくなってしまいました。
具体的には、次のようなコードです。```lang-php
$x = 50;
$y = 150;
$width = 400;
$height = 200;
$font_size = 80;
$angle = 0;
$font_name = "/usr/share/fonts/japanese/TrueType/ipagp.ttf";
$text = "abcde";
$bbox = ImageTtfBBox( $font_size, $angle, $font_name, $text );
$im = imagecreatetruecolor( $width, $height );
$white = imagecolorallocate( $im, 255,255,255 );
$black = imagecolorallocate( $im, 0, 0, 0 );
$blue = imagecolorallocate( $im, 0, 0, 255 );
imagefill( $im, 0, 0, $blue );
ImageFilledRectangle( $im, $x + $bbox[0], $y + $bbox[7], $x + $bbox[2], $y + $bbox[3], $white );
ImageTtfText( $im, $font_size, $angle, $x, $y, $black, $font_name, $text );
#Imagepng( $im, "/var/www/data/abcde.png" );
#print "<img src='/data/abcde.png' />";
header("Content-Type: image/png");
ImagePng( $im );
ImageTtfText によって描画される位置はいずれのバージョンでも同じなのですが、ImageTtfBBox で返される boundary box の位置が rhel7 では誤って返されています。 具体的には、原点より右側から描画するのにbbox[0] が -1 になっています。どなたかご存じの方がいらっしゃいましたら、教えていただけないでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。