Skip to content
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

Closed
upadrian opened this issue Jul 26, 2017 · 4 comments
Closed

makeTextBlock method(abeautifulsite/SimpleImage) missing #196

upadrian opened this issue Jul 26, 2017 · 4 comments
Labels

Comments

@upadrian
Copy link

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; }

@upadrian upadrian changed the title makeTextBlock method missing from abeautifulsite/SimpleImage makeTextBlock method(abeautifulsite/SimpleImage) missing Jul 26, 2017
@claviska
Copy link
Owner

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

@upadrian
Copy link
Author

First, in an old project, i have SimpleImage.php
/**

*/

So, today, i need some image functionality and serched on google.
Found this Github repo and is the same class, but better.

I have successfully used this function to create the lines of text(wrapping the text) and get the lines into an array.
Then, I loop into the array and create the text with ->text()

@claviska
Copy link
Owner

claviska commented Jul 26, 2017

Here is the source for 2.5.5

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.

@upadrian
Copy link
Author

Thank's!

Yes, maybe a fork. It was 2 or 3 years since I work on that proyect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants