ขอรบกวนถามผู้รู้เกี่ยวกับ imagecopymerge ค่ะ
ลองใช้แล้ว ให้แสดงผลเป็น .png ค่ะ แต่ มันแสดงผลเป็น ภาษาต่างด้าวค่ะ ไม่ทราบว่าพอจะมีวิธีแก้ไหมคะ (ใช้ php_gd2.dll ค่ะ)
ขอรบกวนถามผู้รู้เกี่ยวกับ imagecopymerge ค่ะ
ลองใช้แล้ว ให้แสดงผลเป็น .png ค่ะ แต่ มันแสดงผลเป็น ภาษาต่างด้าวค่ะ ไม่ทราบว่าพอจะมีวิธีแก้ไหมคะ (ใช้ php_gd2.dll ค่ะ)
Make sure that your charset configured like thisCode:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=tis-620" /> <title>Generate Image</title> </head> <body>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
รู้สึกปัญหาจะไม่ได้แก้ง่ายอย่างนั้นคับ เพราะนี้คือ image ไม่ใช่ html
ปัญหา น่าจะอยู่ที่การเซ็ตฟอร์นของเซิฟเวอร์คับ มันไม่มีฟอร์นภาษาไทย
วิธีแก้ ลองใช้การเซ็ต Font ในฟังค์ชั่น ของ PHP คือ
1. imagettftext() <-- ใช้การโหลด TureType Font
2. imageloadfont() <-- ใช้การสร้างฟอร์นเป็นไฟล์ gdf
ลองศึกษาดูนะคับ
[url="http://negimatfc.spaces.live.com"]Please Stop Global Warming[/url]
[url="http://akiakira.elivebox.com"]Aki's tool[/url] [b]Update:[/b] [color=#444444]BASE 64 TOOL[/color]
[b][url="http://akiakira.elivebox.com/akigraph"]akigraph[/url] [/b]- free graph opensource (php)
[img]http://cftsubasa.tirkx.com/quiz/sakura.gif[/img]
ขอบคุณค่ะเป็นความรู้ใหม่เลยค่ะ และขอโทษดัวยค่ะ ลืมบอกไปว่าเป็นการเอารูปซ้อนรูปค่ะ จึงไม่น่าเกี่ยวกับ font ค่ะ (ทั้งpageมีแต่รูปค่ะ ไม่มีตัวอักษรเลยค่ะ) ต้องใช้ library เพิ่มไหมคะ
dl('php_gd2.dll'
$imagepng = imagecreatefrompng("arrows/rad90.png");
$imagef = imagecreatefrompng("arrows/rad0.png");
$imagepngW = imagesx($imagepng);
$imagepngH = imagesy($imagepng);
$imagefW = imagesx($imagef);
$imagefH = imagesy($imagef);
imagecopymerge($imagef, $imagepng, $imagepngW-$imagefW-2,$imagepngH-$imagefH-2,0,0,$imagepngW,$imagepngH,100);
imagepng($imagepng);
พอเข้าใจแล้วคับ ปัญหาของคุณตอนนี้เป็นแค่ลืมกำหนด Header พูดง่ายๆ คือ ให้ Browser เข้าใจว่ากำลังอ่านไฟล์ PNG ตอนนี้ จาก Script ที่เอามาให้ดู Browser ยังเข้าใจว่า นั้นไม่ใช่ภาพ แต่เป็น Text file วิธีแก้ง่ายๆ คือ ใส่ Header ให้มันคับ
วิธีแก้ ใส่
header ("Content-type: image/png");
ในบรรทัดแรกสุดคับ สงสัยว่า จะเอาไปทำระบบฟากรูปรึเปล่าเนี่ย :P
[url="http://negimatfc.spaces.live.com"]Please Stop Global Warming[/url]
[url="http://akiakira.elivebox.com"]Aki's tool[/url] [b]Update:[/b] [color=#444444]BASE 64 TOOL[/color]
[b][url="http://akiakira.elivebox.com/akigraph"]akigraph[/url] [/b]- free graph opensource (php)
[img]http://cftsubasa.tirkx.com/quiz/sakura.gif[/img]
ใช่เลยค่ะ เกิดจากการไม่ได้ใส่ header ค่ะ header ("Content-type: image/png");
กับ การที่ต้องเขียน php ไว้ในบรรทัดแรกสุดของโค้ดค่ะ (เพราะ php มองว่า blank line เป็นการใช้ html ค่ะ >> อันนี้ อ. อธิบายมาค่ะ) >> ตอบไว้เผื่อใครมาเจอปัญหาเดียวกะเรา
ปล. ขอบคุณทุกท่านค่ะที่สละเวลามาแบ่งปันความรู้ค่ะ
โปรเจ็กนี้ทำระบบ GIS ค่ะ ฝากรูปคงอีกยากไกล ....!
Actions : (View-Readers)
There are no names to display.