Questions tagged [imagettftext]

174 questions
25
votes
5 answers

Right align text in an image with imagettftext(), PHP

I am setting up dynamic forum signature images for my users and I want to be able to put their username on the image. I am able to do this just fine, but since usernames are different lengths and I want to right align the username, how can I go…
James Simpson
  • 12,799
  • 25
  • 71
  • 104
20
votes
4 answers

Aligning php Generated Image dynamic text in center

i want to align the text generated on the image to the center of the image. for the moment, i dont know if it is possible to align it. below is the code. $im = @imagecreatefromjpeg('poloroid.jpg'); // Create some colors $white =…
Shazery Nasir
  • 281
  • 1
  • 6
  • 16
17
votes
1 answer

imagettfbbox calculates wrong rectangle when text begins with number

The issue is, that when using imagettfbbox to calculate text dimensions, too small rectangle is returned when input text begins with numbers. This is my code: $fontSize = 150; $font = "font/courier_new.ttf"; $text = $_GET["text"]; //Determine font…
16
votes
5 answers

make text string read from right to left in imagettftext() function

i know this question may sound you odd but i am very worry about it that why i came to you .. I want to write a text string from right to left instead of from left to right with the imagettftext (); function I read in teh manual that the angle…
Ahmad Sattar
  • 321
  • 2
  • 10
12
votes
3 answers

Error while writting Arabic to image

My previous related question: php work with images : write complete word in arabic , ttf font My problem was: If I want to write احمد in image it appears as د م ح ا Well, I fixed it and now the output: ا ح م د Using this function: function…
Passer By
  • 181
  • 1
  • 11
11
votes
2 answers

Text out of the box for converting into image in php

I am trying to convert text into image. I already did it, but the are some cases when text is out of the image box The "e" of the word "The" is cut. I have tried decreasing the font size or increasing the width of the image, but in some cases this…
Luis
  • 285
  • 3
  • 17
9
votes
2 answers

PHP imagettftext baseline workaround

I am writing to print text to an image using PHP. However, the function imagettftext() uses the baseline, whereas I need the text vertically centered. So, I either need a method to print text with y not the distance from top to baseline, but from…
arik
  • 23,480
  • 35
  • 91
  • 147
8
votes
5 answers

PHP - imagettftext not working and GD installed

It's being long hours that I'm still looking for answer to this problem.. All the solutions I find are around catching the font name but I am pretty sure this isn't my problem. It looks like GD is installed array(11) { ["GD Version"]=> …
Steve Peretz
  • 81
  • 1
  • 1
  • 2
7
votes
2 answers

Font that supports all utf-8 characters for php imagettftext

I'm using imagettftext in php to generate images. Is there a true type font that supports all utf-8 characters?
Tom Kincaid
  • 4,635
  • 5
  • 43
  • 67
7
votes
6 answers

php imagettftext letter spacing

Does anybody have a function that draws a ttf string (imagettftext) with specified letter spacing? I cannot find any build-in GD function so I think that it should be done letter by letter adding some constant width. Maybe someone have such function…
radzi0_0
  • 1,200
  • 2
  • 13
  • 23
7
votes
4 answers

Using the imagettftext function with multiple lines? Anyone done this before?

I'm creating transparent text -> png images with php and so far so good. The only problem is that I want the ability to have the text word wrap due to a fixed width.. Or alternatively be able to insert breaklines into the text. Has anyone had any…
ionfish
  • 133
  • 1
  • 4
  • 9
7
votes
4 answers

imagettftext cannot open font file

Using the example from php.net I get a warning, and the image is not rendered correctly. I supply a full path to the .ttf file like so: /var/www/public/myfont.ttf PHP Warning: imagettftext() [
Jon Skarpeteig
  • 4,053
  • 6
  • 32
  • 52
7
votes
1 answer

PHP GD Text with Transparency/Alpha background

alright so im having a problem with getting my text layed over a partly transparent image. i want the text to be solid, but i want part of the background of the image to be transparent, and the part the text is over to be solid, which i have, the…
user258640
  • 261
  • 1
  • 2
  • 5
6
votes
2 answers

Open OTF fonts with php - greek characters included

So, as the title says, my task is to convert a given phrase to an image on server side (php GD) with a selected .otf font. The phrase can include not only latin characters but also greek and cyrillic. PHP's imagettftext…
magtak
  • 890
  • 1
  • 9
  • 20
1
2 3
11 12