Php funny Avatar puzzles
When studying the GD library of php, I found a piece of code written by others. Here I hope to increase everyone's enthusiasm for php. This code mosaic the person's profile picture, which looks interesting.
Function pixelfuck ($ url, $ chars = 'ewk34543 § G § $ Tg34g4g ', $ shrpns = 1, $ size = 4, $ weight = 2) {list ($ w, $ h, $ type) = getimagesize ($ url); $ resource = imagecreatefromstring (file_get_contents ($ url )); $ img = imagecreatetruecolor ($ w * $ size, $ h * $ size); $ cc = strlen ($ chars); for ($ y = 0; $ y <$ h; $ y + = $ shrpns) for ($ x = 0; $ x <$ w; $ x + = $ shrpns) imagestring ($ img, $ weight, $ x * $ size, $ y * $ size, $ chars {+ $ p % $ cc}, imagecolorat ($ resour Ce, $ x, $ y); return $ img;} $ url = 'HTTP: // www.bkjia.com/uploads/allianc140830/0421361239-0.png'{{text = 'I-dont-like-manga -... -Why-do-they-have-such-big-eyes? Strange-...-WHAT-WANT-YOU-DO? '; Header ('content-Type: image/png'); imagepng (pixelfuck ($ url, $ text, 1, 6 ));
The following is the original image, and the other is the processed image.