Results 1 to 6 of 6

Thread: ขอรบกวนถามผู้รู้เรื่อง imagecopymerge ค่ะ

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    12


    ขอรบกวนถามผู้รู้เกี่ยวกับ imagecopymerge ค่ะ
    ลองใช้แล้ว ให้แสดงผลเป็น .png ค่ะ แต่ มันแสดงผลเป็น ภาษาต่างด้าวค่ะ ไม่ทราบว่าพอจะมีวิธีแก้ไหมคะ (ใช้ php_gd2.dll ค่ะ)

  2. #2
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    Code:
    <!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>
    Make sure that your charset configured like this
    <meta http-equiv="Content-Type" content="text/html; charset=tis-620" />

  3. #3


    รู้สึกปัญหาจะไม่ได้แก้ง่ายอย่างนั้นคับ เพราะนี้คือ 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&#39;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]

  4. #4
    Junior Member
    Join Date
    Mar 2007
    Posts
    12


    ขอบคุณค่ะเป็นความรู้ใหม่เลยค่ะ และขอโทษดัวยค่ะ ลืมบอกไปว่าเป็นการเอารูปซ้อนรูปค่ะ จึงไม่น่าเกี่ยวกับ font ค่ะ (ทั้งpageมีแต่รูปค่ะ ไม่มีตัวอักษรเลยค่ะ) ต้องใช้ library เพิ่มไหมคะ

    dl(&#39;php_gd2.dll&#39;
    $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);

  5. #5


    Exclamation

    พอเข้าใจแล้วคับ ปัญหาของคุณตอนนี้เป็นแค่ลืมกำหนด 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&#39;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]

  6. #6
    Junior Member
    Join Date
    Mar 2007
    Posts
    12


    ใช่เลยค่ะ เกิดจากการไม่ได้ใส่ header ค่ะ header ("Content-type: image/png");
    กับ การที่ต้องเขียน php ไว้ในบรรทัดแรกสุดของโค้ดค่ะ (เพราะ php มองว่า blank line เป็นการใช้ html ค่ะ >> อันนี้ อ. อธิบายมาค่ะ) >> ตอบไว้เผื่อใครมาเจอปัญหาเดียวกะเรา


    ปล. ขอบคุณทุกท่านค่ะที่สละเวลามาแบ่งปันความรู้ค่ะ
    โปรเจ็กนี้ทำระบบ GIS ค่ะ ฝากรูปคงอีกยากไกล .... !

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •