Prev: Storing Social Security Number WAS:Encryption/Decryption Question
Next: Setting up a 2 Column Display for SQL Recordset
From: Floyd Resler on 12 Aug 2010 10:40 I'm trying to draw text at a 90 degree angle, reading from bottom to top. For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It looks really odd! Has anyone else experienced this before? Thanks! Floyd
From: Ashley Sheridan on 12 Aug 2010 10:42 On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: > I'm trying to draw text at a 90 degree angle, reading from bottom to top. For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It looks really odd! Has anyone else experienced this before? > > Thanks! > Floyd > Do you have a code example and maybe a screenshot/image online somewhere that we can see. I can't really understand exactly what the problem is without one or both of those. Thanks, Ash http://www.ashleysheridan.co.uk
From: Floyd Resler on 12 Aug 2010 10:50 On Aug 12, 2010, at 10:42 AM, Ashley Sheridan wrote: > On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: > >> I'm trying to draw text at a 90 degree angle, reading from bottom to top. For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It looks really odd! Has anyone else experienced this before? >> >> Thanks! >> Floyd >> > > > Do you have a code example and maybe a screenshot/image online somewhere > that we can see. I can't really understand exactly what the problem is > without one or both of those. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Certainly. You can see a screen shot at https://adexfulfillment.com/adex/images/problem.png. The code I use to generate it: foreach($headers as $header) { if($header!="Client" && $header!="Show" && $count<19) { $angle=90; } else { $angle=0; } $sizes=imagettfbbox(10,$angle,$ttf,$header); $height=abs($sizes[5]); if($angle==0) { $width=abs($sizes[2])+5; $top=$height-1; $left=0; } else { $width=abs($sizes[4])+5; $height+=15; $top=$height-2; $left=0; } $image=imagecreate($width,$height); $white=imagecolorallocate($image,255,255,255); $black=imagecolorallocate($image,0,0,0); imagefilledrectangle($image,0,0,$width,$height,$white); imagettftext($image,10,$angle,$left,$top,$black,$ttf,$header); $count++; $number=rand(1,100000); $path="../../../../tmp/report_$number.png"; imagepng($image,$path); $newHeaders[]="<img src=\"$path\">"; } Thanks! Floyd
From: tedd on 12 Aug 2010 11:50 > On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: > >> I'm trying to draw text at a 90 degree angle, reading from bottom >>to top. For some reason, all of the letters are aligning to the >>top (i.e. the left side) of the text. It looks really odd! Has >>anyone else experienced this before? >> >> Thanks! >> Floyd Floyd: Yes, that is odd -- try this: Header ("Content-type: image/gif"); $im = imagecreate (400, 400); $background = imagecolorallocate ($im, 238, 238, 238); $text_color = imagecolorallocate ($im, 00, 51, 102); imagettftext ($im, 10, 90, 200, 200, $text_color, "arial.ttf", "Hello World..."); imagegif ($im); imagedestroy ($im); You must use arial.ttf for the above -- in fact, that might be your problem, the font you are using may be that way. Here's an example of this working: http://webbytedd.com/b/timed-php/ Cheers, tedd -- ------- http://sperling.com/
From: Floyd Resler on 12 Aug 2010 12:14
On Aug 12, 2010, at 11:50 AM, tedd wrote: >> On Thu, 2010-08-12 at 10:40 -0400, Floyd Resler wrote: >> >>> I'm trying to draw text at a 90 degree angle, reading from bottom to top. For some reason, all of the letters are aligning to the top (i.e. the left side) of the text. It looks really odd! Has anyone else experienced this before? >>> >>> Thanks! >>> Floyd > > Floyd: > > Yes, that is odd -- try this: > > Header ("Content-type: image/gif"); > $im = imagecreate (400, 400); > $background = imagecolorallocate ($im, 238, 238, 238); > $text_color = imagecolorallocate ($im, 00, 51, 102); > imagettftext ($im, 10, 90, 200, 200, $text_color, "arial.ttf", "Hello World..."); > imagegif ($im); > imagedestroy ($im); > > You must use arial.ttf for the above -- in fact, that might be your problem, the font you are using may be that way. > > Here's an example of this working: > > http://webbytedd.com/b/timed-php/ > > Cheers, > > tedd Well, whatever the problem is it is definitely related only to my system. I tried your code and had the same results (https://adexfulfillment.com/adex/tests/test.php). I tried different fonts as well. The fonts I'm using were exported from FontBook on my Mac. I wonder if that might have something to do with it. Anyway you could pass along the arial font you're using so I can test that possibility? Thanks! Floyd |