Home > Archive > PHP Language > December 2006 > create images with special chars
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
create images with special chars
|
|
| Ask Josephsen 2006-12-11, 7:01 pm |
| Hi
I want to create an image with vertical text, but how do I handle
special chars like "זרו"? I'm using php version 4.4.2.
This is my code so far:
$string = "זרו";
$fh = 6;
$im = imagecreate ( 14, strlen($string)*$fh+2 );
$bg = imagecolorallocate ( $im, 255, 17, 255 );
$black = imagecolorallocate($im, 0, 0, 0);
for ( $j=strlen($string)*$fh, $i=0; $i<strlen($string); $i++, $j-=$fh )
imagecharup ( $im, 2, 0, $j, $string[$i], $black );
header('Content-type: image/png');
imagepng($im);
Thanx
Ask
| |
| petersprc 2006-12-11, 7:01 pm |
| Hi,
If you need more symbols, you can use a True Type font with
imagettftext (specify a vertical angle for your example). You could
also try loading another bitmap font with imageloadfont.
In my version of PHP (4.4.2), the built-in GD font seems to use the ISO
8859-2 character set. You can see the characters here:
http://nl.ijs.si/gnusl/cee/charset.html
For instance, latin "ae" is not shown. And I'm not sure if all
available chars are represented in the font...
Ask Josephsen wrote:
> Hi
>
> I want to create an image with vertical text, but how do I handle
> special chars like "=E6=F8=E5"? I'm using php version 4.4.2.
>
> This is my code so far:
>
> $string =3D "=E6=F8=E5";
> $fh =3D 6;
>
> $im =3D imagecreate ( 14, strlen($string)*$fh+2 );
> $bg =3D imagecolorallocate ( $im, 255, 17, 255 );
> $black =3D imagecolorallocate($im, 0, 0, 0);
>
> for ( $j=3Dstrlen($string)*$fh, $i=3D0; $i<strlen($string); $i++, $j-=3D$=
fh )
> imagecharup ( $im, 2, 0, $j, $string[$i], $black );
>
> header('Content-type: image/png');
> imagepng($im);
>=20
>=20
> Thanx
> Ask
|
|
|
|
|