Imagestring - Larger Font or Image Size?

From: David McCulloch (|_at_|.|)
Date: 04/28/04


Date: Tue, 27 Apr 2004 21:50:45 -0500

QUESTION: How can I increase either the font-size used by "imagestring" or
the overall image size so as to stretch the font in either or both
dimensions?

I am new to PHP's image capabilities. When I create a file as follows, I
would like a font-size of 1.5- to 2-times what I actually see.

$string = "123456";
$font = 5;
$factor = 1;
$width = ImageFontWidth($font) * strlen($string) * $factor;
$height = ImageFontHeight($font) * $factor;
$im = @imagecreate ($width,$height);
$back_color = imagecolorallocate ($im, 231, 231, 247);
$text_color = imagecolorallocate ($im, 0, 0, 0);
imagefill($im, 0, 0, $back_color);
imagestring($im, $font, 0, 0, $string, $text_color);
header ("Content-type: image/jpeg");
imagejpeg($im);

Any help would be greatly appreciated!

Dave



Relevant Pages

  • Re: Imagestring - Larger Font or Image Size?
    ... > or the overall image size so as to stretch the font in either or both ... > I am new to PHP's image capabilities. ...
    (alt.php)
  • Re: IE7 doesnt display background..
    ... What you really should correct is the font-size ... font: 10px tahoma, arial, sans-serif; ... It makes no sense to be using anything smaller than 12px or 13px for body element. ... Using Web Standards in your Web Pages ...
    (comp.infosystems.www.authoring.html)
  • Re: Problems with cascade in menus
    ... David Morris wrote: ... I thought 1.5em was proportional to the font-size of the parent element. ... ...by specifying 'ems' you are using the parent ... number is the font size of the text in the element. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Fonts-size differs between IE and Firefox
    ... the font size is fine in Firefox, it is illegibly small when looked at ... 'ms ui gothic', 'microsoft sans serif', arial, ... font-size: 1.05em; ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: containing floating img height within a div
    ... Google: html, body {font-size: small} ... These are sites that have spent extraordinary sums of money ... noticed, just as you have, that default browser font sizing is ...
    (comp.infosystems.www.authoring.stylesheets)