Dynamically generates a word cloud?

Ok, ok, what I would like to do in PHP:

http://www.wordle.net/

I know how to do everything GD (writing to the canvas), my problem is the logic of tracking different sizes of text blocks and placing them correctly on an empty canvas. If someone knows about a good site that has some resources that can lead me in the right direction, I will love you forever!

+5
source share
2 answers

Well, you can use imagettfbox (see also http://ruquay.com/sandbox/imagettf/ ) to get the borders of the canvas in the text of the tag that you created - taking into account the font, rotation and size (which obviously depends from the number of occurrences of any given tag).

From this point, you can start placing tags (randomly? - see edit ) in a cloud canvas until all of them are placed. You just need to make sure that they do not overlap (i.e. you can store the pixel coordinates in an array).

, , - ( ), , ( , imagettfbox) , , , imagettftext.

EDIT. (, , ), credits, :

, , , . " , ."

...

+2

tutorial, jQuery CSS - php , ( ).

0

All Articles