Well, right now, I can get text into a generated image, and everything, but say I wanted to do this:
http://dcah.z27.net/board/txt.php?txt=Need to have a line break<br>here
is there a way I can make it so, wherever I have <br> or even \n or anything really, be replaced with an actual line break? ive tried eregi_replace, explode, etc...but I can figure it out.
Another GD Question.
Moderator: General Moderators
-
dyonak
- Forum Commoner
- Posts: 56
- Joined: Wed Jun 22, 2005 10:22 am
- Location: Minneapolis, MN
- Contact:
I haven't tested this but I assume all you would need is a
This will lend proper syntax to your url ie http://dcah.z27.net/board/txt.php?txt=N ... line+break
Edit:
My bad you aren't looking for spaces, though you may need that as well. For line breaks I'm not sure but I would try to code that into your GD script, pass it some type of indicator like if you want to use <br /> just have your GD script look through the string for <br />'s as an explode point. With the array that it generates you can run the script multiple times for each line.
Code: Select all
urlencode($_GET['string']);Edit:
My bad you aren't looking for spaces, though you may need that as well. For line breaks I'm not sure but I would try to code that into your GD script, pass it some type of indicator like if you want to use <br /> just have your GD script look through the string for <br />'s as an explode point. With the array that it generates you can run the script multiple times for each line.
Last edited by dyonak on Mon Nov 21, 2005 9:46 am, edited 1 time in total.
nope...that just messes everything up, and makes certain characters turn into stuff like %20%13 etc etc...and it changes <br> into %3Cbr%3E so thats not what im looking for.
im not sure if you know what I was saying though, basically, the script outputs an image with the text based on the string variable, and doing that, line breaks dont work, so I want it so I can do the following
something<br>
then after the br it goes on another line.
im not sure if you know what I was saying though, basically, the script outputs an image with the text based on the string variable, and doing that, line breaks dont work, so I want it so I can do the following
something<br>
then after the br it goes on another line.
-
dyonak
- Forum Commoner
- Posts: 56
- Joined: Wed Jun 22, 2005 10:22 am
- Location: Minneapolis, MN
- Contact:
Sorry for the misread there. For line breaks I'm not sure but I would try to code that into your GD script, pass it some type of indicator like if you want to use <br /> just have your GD script look through the string for <br />'s as an explode point. With the array that it generates you can run the script multiple times for each line.
In a word, no.
In a long, probably hair pulling function, yes.
Line breaks are not "possible" in the method in what you ask, each line must be added with imagettftext() or similar function.
So something like:
untested™
In a long, probably hair pulling function, yes.
Line breaks are not "possible" in the method in what you ask, each line must be added with imagettftext() or similar function.
So something like:
Code: Select all
<?php
$lines = explode("\n", $_GET['text']);
foreach ($lines as $line => $val) {
imagettftext($image, $size, $angle, $x, (($y + $size) * ($line + 1)), $colour, $fontfile, $val);
}
?>