I'm playing with some code to put text on an image:

http://www.collegeSherbrooke.qc.ca/languesmodernes/course/image/marc.php

Because I'm using a fixed font, I know I don't want to go over 34
characters per line. I calculate my maximum number of chatraacters to
be  476.

How can I parse $string to "wrap", keeping in mind spaces between words
and the occasional \n that $string might contain?

I know it would have somethig to do with strlength and exploding to
count spaces, but ... ?

Thanks,
John

Here is the code I am playing with:

<?php
    Header("Content-type: image/png");
//    $string=implode($argv," ");
$string="1234567890123456789012345678901234";
//    $string=urldecode($string);
    $im = imagecreatefrompng("button1.png");
    $orange = ImageColorAllocate($im, 255, 0, 64);
    $px = (imagesx($im)-7.5*strlen($string))/2;
 //image
 //font built-in
 //position x
 //position y
 //string
 //colour
//   ImageString($im,3,$px,9,$string,$orange);
    ImageString($im,3,241,30,$string,$orange);
    ImageString($im,3,241,40,$string,$orange);
    Imagepng($im);
    ImageDestroy($im);
?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to