الدوال Functions
الفصل الرابع
تستخدم الدالة Imagestring لكتابة نص على منطقة العمل مع تحديد مقبض الصورة
ولون النص ، مثال :
أمثلة :
Imagestring ($pic01, 4, 10, 10, "Program sale", $colorGreen);
$white = ImageColorAllocate ($im, 255, 255, 255); $black ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate($im, 255, 255, 255); ImageColorDeAllocate($im, $white);
// Example Creating GD image stream and output image header ("Content-type: image/png");
$im =
@ImageCreate (50, 100)
or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 255); $text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color); ImagePng ($im);
مثال لمعرفة ما إذا الخادم يدعم الصور أم لا :
if (function_exists("imagegif")) { Header("Content-type: image/gif"); ImageGif($im);
}
elseif (function_exists("imagejpeg")) { Header("Content-type: image/jpeg"); ImageJpeg($im, "", 0.5);
}
elseif (function_exists("imagepng")) { Header("Content-type: image/png"); ImagePng($im);
}
else
die("No image support in this PHP server");
نتيجة هذا المثال عند تعطيل مكتبة GD هي
١٤٨
ص ١٤٨