Jump to content

PHP image/font questions


bachx

Recommended Posts

I want to dynamically generate an image containing a text string that the user defines, I have a couple of questions though.

 

- I want to set a font size for the text higher than 5 (Which is the maximum size imagestring() allows)

- I want to change the font type

- I want to align the text to the right.

 

Any tips/help is appreciated. Thanks in advance.

 

Here is the code I'm using to generate the image:

 

<?php

$chars = $_GET['title'];
$width = strlen($chars)*10;

$image = ImageCreate($width, 40); 
$bg_color = ImageColorAllocate($image, 174, 160, 133);
$fnt_color = ImageColorAllocate($image, 255, 255, 255);
imagestring($image, 5, 8, 5, $chars, $fnt_color);
$image = imagerotate($image, 90, 0);
imagePNG($image);
imageDestroy($image);

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.