-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
makeTextBlock method(abeautifulsite/SimpleImage) missing #196
Comments
Where are you finding that? That last 2.x release doesn't have that method. If you're looking for text wrapping in 3.x, refer to this issue: #137 |
First, in an old project, i have SimpleImage.php
*/ So, today, i need some image functionality and serched on google. I have successfully used this function to create the lines of text(wrapping the text) and get the lines into an array. |
I still don't know where you got that method from (maybe a fork or an altered version?). Regardless, text wrapping is an open issue. If you have an elegant solution, PRs are always welcome. |
Thank's! Yes, maybe a fork. It was 2 or 3 years since I work on that proyect. |
Some time ago, I used this class but under a abeautifulsite namespace to insert text over a image.
In this version of SimpleImage, the metod makeTextBlock is missing.
This method calculates the lines of text wrapping the entire phrase.
It's missing beacuse this functionality is elsewhere? Or is missing for another reason?
public function makeTextBlock($text, $fontfile, $fontsize, $width) { $words = explode(' ', $text); $lines = array($words[0]); $currentLine = 0; for ($i = 1; $i < count($words); $i++) { $lineSize = imagettfbbox($fontsize, 0, $fontfile, $lines[$currentLine] . ' ' . $words[$i]); if ($lineSize[2] - $lineSize[0] < $width) { $lines[$currentLine] .= ' ' . $words[$i]; } else { $currentLine++; $lines[$currentLine] = $words[$i]; } } return $lines; }
The text was updated successfully, but these errors were encountered: