 |

17-05-2009, 22:27
|
|
|
|
חבר מתאריך: 10.04.05
הודעות: 235
|
|
|
GD ב PHP
מה נשמע? קיצור יש לי קוד ישן שאני רוצה לשחזר אותו, משום מה לא מצאתי את הטעות שבו... הוא מראה לי שגיאה:
<img>The image “ http://itzikc20.kuchi.be/upload/1.php?start_date=10/25/2006&end_date=10/24/2009” cannot be displayed, because it contains errors.
אתם יכולים לעזור לי למצוא אותה? (אני יודע שהקוד הוא לא משהו ויש הרבה דברים מיותרים אבל זה נושא אחר...) קיצור זה הקוד:
קוד PHP:
<?php header('Content-Type: text/html; charset=utf-8'); header('Content-type: image/png;');
function HebrewConvert($text) { $text = iconv('UTF-8', 'windows-1255', $text); return iconv('windows-1255', 'UTF-8', hebrev($text)); }
//קליטת משתנים לחישוב זמן $start_date=$_GET['start_date']; $end_date=$_GET['end_date']; //קצת חישובים
$convert_date = date('U', strtotime($start_date)); $start_date_time = date('m/d/Y', $convert_date);
$convert_date_end = date('U', strtotime($end_date)); $end_date_time = date('m/d/Y', $convert_date_end);
//חישוב כל התקופה שהמשתמש הכניס $remain=$convert_date_end-$convert_date; $remain_all=$remain/60/60/24;
$now_date=date("m/d/Y"); $convert_date_now = date('U', strtotime($now_date));
#חישוב כמה זמן נותר למשתמש!
$remain_final=$convert_date_end-$convert_date_now; $remain_final_day=$remain_final/60/60/24; #חישוב כמה זמו המשתמש כבר עבר $passed = floor((time() - strtotime($start_date))/60/60/24);
if($remain_final_day>0){ $text="נשארו לי עוד ".$remain_final_day ." ימים לשחרור!";
} elseif($remain_final_day==0 OR $remain_final_day<0){ $text="אתה אדם חופשי!"; }
/* Vars setup: */ $tSize = 16; # Font size: 16 $font = 'TIMES.TTF'; # Font type: times new roman
$boxSize = imagettfbbox($tSize, 0, $font, $text);
$width = $boxSize[2]+400; $height = $boxSize[1] - $boxSize[7] + $boxSize[3] + 100; $im = imagecreatetruecolor($width,$height);
$black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, $width, $height, $white);
$ahoz=$passed/$remain_all*100; $ahoz_output=round($ahoz ,2); $ahoz_pic=round($ahoz);
imagettftext($im, $tSize,0,0, 20, $black, $font, HebrewConvert($text)); if($remain_final_day>0){ $text=" עברתי כבר ".$passed." ימים! האחוז שעברתי הוא ".$ahoz_output.""; imagettftext($im, $tSize,0,80, 40, $black, $font, HebrewConvert($text)); } imagettftext($im, "8",0,0, 110, $black, $font, "Build By itzikc20");
//קארמה?
// set the width and height of the new image in pixels
// sets background to white $white = ImageColorAllocate($im, 255, 255, 255); ImageFillToBorder($im, 0, 0, $white, $white);
// define black and blue colours $black = ImageColorAllocate($im, 0, 0, 0); $blue = ImageColorAllocate($im, 0, 0, 255);
// define the dimensions of our rectangle $r_width = 100; $r_height = 30; $r_x = 80; $r_y = 50;
ImageRectangle($im, $r_x, $r_y, $r_x+$r_width, $r_y+$r_height, $black);
// define the dimensions of our filled rectangle #חישובים #השלם הוא $remain_all החלק הוא מה שעברנו שהוא $passed כל שנותר הוא לחשב את האחוז....
$r_width=$ahoz_output; $r_height = 29; $r_x = 80; $r_y = 50; imagettftext($im, "16",0,120, 70, $black, $font, "".$ahoz_output."%"); ImageFilledRectangle($im, $r_x, $r_y, $r_x+$r_width, $r_y+$r_height, $blue); //סוף בניית הקארמה
imagepng($im); imagedestroy($im);
?>
_____________________________________
חתימתכם הוסרה כיוון שלא עמדה בחוקי האתר. לפרטים נוספים לחצו כאן. תוכלו לקבל עזרה להתאמת החתימה לחוקים בפורום חתימות וצלמיות.
|
|