בניתי תמונה
שמגרילה משפט
וכותבת אותו על תמונה (חתימה)
אז בכדי לשים משפטים ארוכים יותר בניתי משהו שיחתוך לי מחרוזת אבל לא באמצע מילה וידפיס אותה מתחת וכמו שאולי הבנתם כבר זה לא עובד לי
התוכנית במלואה:
PHP קוד:
<?php
header("Content-type: image/png");
$img = imagecreate(470,70);
$Hcolor = imagecolorallocate($img, 247, 247, 247);
$bcolor = imagecolorallocate($img, 0, 0, 0);
$tfont = "david.ttf";
imagerectangle($img, 0, 0, 470, 70, $Hcolor);
$input = array(
"Guns don't kill people. Chuck Norris kills People.",
"There is no theory of evolution. Just a list of animals Chuck Norris allows to live. ",
"Chuck Norris does not sleep. He waits.",
"The chief export of Chuck Norris is Pain. ",
"There is no chin under Chuck Norris' Beard. There is only another fist. ",
"Chuck Norris has two speeds. Walk, and Kill. ",
"The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.",
"Chuck Norris drives an ice cream truck covered in human skulls.",
"When the Boogeyman goes to sleep every night, he checks his closet for Chuck Norris.",
"Outer space exists because it's afraid to be on the same planet with Chuck Norris.",
"Chuck Norris is suing Myspace for taking the name of what he calls everything around you."
);
$ke= array_rand($input, 1);
$stf=$input[$ke];
$slen=strlen($stf);
if ($slen<70) {
imagettftext ( $img, 12, 0, 2, 15, $bcolor, $tfont, $stf );
} else {
// ראו חלק זה VVV
$words = explode(" ", $stf);
$numw=count($words); // מספר מילים
$b=0;
for ($i=0;$i<=$numw;$i++) {
$len=0;
while ($len<70) {
$arr[$b]=$arr[$b].$words[$i]." ";
$len=strlen($arr[$b]);
$i++;
}
$b++;
}
// problem here ^^^^
for ($i=1;$i<=$b;$i++) {
$hi=15*$i;
$ia=$i-1;
$te=$arr[$ia];
imagettftext ( $img, 12, 0, 2, $hi, $bcolor, $tfont, $te );
}
}
imagepng($img);
imagedestroy($img);
?>
אנא עזרו לי לפני שאני נשאר ללא שיערות