create images with special chars

This is a discussion on create images with special chars within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi I want to create an image with vertical text, but how do I handle special chars like "זרו"? ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-07-2006
Ask Josephsen
 
Posts: n/a
Default create images with special chars

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
Reply With Quote
  #2 (permalink)  
Old 12-07-2006
petersprc
 
Posts: n/a
Default Re: create images with special chars

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 "זרו"? 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


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:35 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0