所以我有这个: https ://indigodaddy.koding.com/
(基本上直接来自http://us2.php.net/manual/en/function.imagettftext.php)
<?php
// Set the content-type
header('Content-Type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = `../../../bin/pwgen -ny 12`;
// Replace path by your own font path
$font = 'font/DejaVuSans-Bold.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
如何使 txt 到图像的转换接受 pwgen -ny -12 的整个输入?这将输出 6 列 12 字符的密码,例如: http: //pwgen.net/。我希望将整个输出转换为 png,而不仅仅是第一个密码,就像现在一样。
有任何想法吗?
** 根据要求编辑 pwgen -ny 12 的示例输出:
Uo/thengohy5 phie=Tahw8ko Cohh1seiz]ua ooY@ee4chei) noo}Mioyei5u au$x5Isaigho
aht6vahGia{j aeph8yoh#kuY EeNgees#ae4k boh5yie1Ic\e aiSh5bahp]ai kiex%ahL0Oob
bei|G{ohm8ae Ieth|ee|wee9 koo@R2iZeot" Nai5Phain(ie Oam*ub0thoth quu6Eyimohd-
geeNgool}ee1 Oow5Pie_sija ab#ahcoo8eeJ ahcoe_r6Vae3 pi%wiedeit4A biegh}u@vu6K
euwei.gei9Of ahr?ai2UquaZ ha3eiXee"koo eiLohf*u1sao ave&aqui8Hie oc-a@z'oh1Le
iv$eeX0eo0Wu rel7aGh6gee& baig3ooN%uz, eoj9eGo.haih Aoka4Uizae:r aiG6aiP.iera
IaY?oo0Aibai pekaeth5Aeh% taav*eiK5Soo zohL5haeng?o teT^u3yash3S xudoh%Dai4ph
tho`R\ahd7ae ohf#e9Ceeph7 Uce7ou{woe8o eeb9jo!Y#aep la7Voo.chae7 te;y5Choo4ie
neeZ5out'oo) ze{iw4Aethok fah3Shoh^Re9 Quoo8au%koot xo2chu>Lae0e Shee#g1eibak
que5Og3aiN&e aw(eetooJ5Ei aeV8ging(eib ohGh9Chah[ch ieYiv5gagh-a kahm2yohR%uo
Eiraivi!o}W0 eo0Oot{ai5sh saT[ae2ahj5O Aefae,l5ieth jo0iJ,ai5eih deer9Aigol'i
aet1Ce,za+fi OFi3exoh)ng3 tae7ooGhaim/ nei$V8Ohh!ae eiy~ia4Itoh; Baisish+ai5d
iib+ooHaoj4t Ayac3aiCh>ee ka/eChoosh2c vanu1Zeex#uy phieB(ai8iev Ou|Gh3zuwo,f
ool3AxiNo~ch zai3Eew&ie*w Zee7eey4eJ*o kooree9Va>B5 FaiB-ah8yahK oha4uP3Oth<o
Aegah2aesh.u eiQuuduu>v1M ae5re8yaXuw% gei5rua1Lu/i eeNg3uyaf"ei Ootee|h8Shai
sa6ed0nieF+e aed8rah;Kai4 boghahH]a7ei eiba$Roh5uu' Ook6oonae`th Vai9taer#oo?
aich7ohMoi/d Ohh1ew-aa"xi Eig%ae]jo2ne urooX1iagh|u iiY8reew,i8d eGhee4fahw(a
ieS%ai1ieh4e pun9Ich0jee; Waer_ai1ieph re)Che`xud0A Aek2wioh\a2u deedae0Ai[be
ohr!a4Ohtae* keNai8aes%oh ookiM3uiRei~ fei-Boo2tu3i coo=c4Yie?w8 ThaiN7fe$o"t
ahw[uChae3va Ej5Evaa&Giix seat|eeZ1yae ee5wiengo]Ba Oo2aThu^p!ai ez{i4too8ohD