TAILIEUCHUNG - PHP and MySQL Web Development - P86

PHP and MySQL Web Development - P86: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Using Text and Fonts to Create Images 397 Figure A button generated by the script. Listing This Script Can Be Called from the Form in or from Within an HTML Image Tag php check we have the appropriate variable data variables are button-text and color button_text HTTP_POST_VARS button_text color HTTP_POST_VARS color if empty button_text empty color echo Could not create image - form not filled out correctly exit create an image of the right background and check size im imagecreatefrompng color. width_image ImageSX im height_image ImageSY im Our images need an 18 pixel margin in from the edge image width_image_wo_margins width_image - 2 18 height_image_wo_margins height_image - 2 18 Work out if the font size will fit and make it smaller until it does Start out with the biggest size that will reasonably fit on our buttons font_size 33 398 Chapter 19 Generating Images Listing Continued you need to tell GD2 where your fonts reside putenv GDFONTPATH C WINNT Fonts fontname arial do font_size-- find out the size of the text at that font size bbox imagettfbbox font_size 0 fontname button_text right_text bbox 2 right co-ordinate left_text bbox 0 left co-ordinate width_text right_text - left_text how wide is it height_text abs bbox 7 - bbox 1 how tall is it while font_size 8 height_text height_image_wo_margins width_text width_image_wo_margins if height_text height_image_wo_margins width_text width_image_wo_margins no readable font size will fit on button echo Text given will not fit on button. br else We have found a font size that will fit Now work out where to put it text_x width_image - width_text text_y height_image - height_text if left_text 0 text_x abs left_text add factor for left overhang above_line_text abs bbox 7 how far above the baseline text_y above_line_text add baseline factor text_y - 2 adjustment factor for shape of our template white ImageColorAllocate im 255 255

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.