View Full Version : Wordwrap using ImageString()
02-15-2006, 09:25 AM
I am using imagestring() to dynamically write onto image that I have. I have a problem where I want to write only in a specific part of my image.
Like if my string is longer than my image, I don't want my string to run off the edge of my image. I am searching for a way to have my string wrap to the next line. Any suggestions?
02-17-2006, 04:14 AM
I guess I'll have to find out the maximum amount of characters I have before my string falls off my image.......use something like strlen() and if my string is too long.....use something like strrpos() to find the last safe " " ....cut my string........and then use the imagestring() at a new y coordinate and repeat the process as necessary.
I know this might not be perfect logic off the top of my head. But I'll try to write this as a function and post for anyone else to use if interested.
ralph l mayo
02-17-2006, 04:35 AM
Your image width should be imagefontwidth(integer value of the font you're using) * the number of chars you are wrapping at or the length of the string, whichever is less + any padding you want.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.