Professional Web Applications Themes

Using imagePNG() !!! - PHP Development

Hello, I would like to write text in an existing image png. Like making a menu but in several languages. When I create a page with only the code below, it goes well. The text fits well in each 4 button which I make then reactive. On the other hand when I put this code in a cell of a table, it is the dump image which goes up. Somebody could it help me. Thank you very much by advance. Here is the code: <? header("Content-type: image/png"); $im = imagecreatefrompng("images/4button.png"); $color = imagecolorallocate($im, 0, 0, 153); $string="Situation"; $px = (imagesx($im)-7.5*strlen($string))/2; ...

  1. #1

    Default Using imagePNG() !!!

    Hello,

    I would like to write text in an existing image png. Like
    making a menu but in several languages.

    When I create a page with only the code below, it goes well. The text
    fits well in each 4 button which I make then reactive.

    On the other hand when I put this code in a cell of a table, it is the
    dump image which goes up.

    Somebody could it help me. Thank you very much by advance.

    Here is the code:

    <?
    header("Content-type: image/png");
    $im = imagecreatefrompng("images/4button.png");
    $color = imagecolorallocate($im, 0, 0, 153);
    $string="Situation";
    $px = (imagesx($im)-7.5*strlen($string))/2;
    imagestring($im,3,$px,16,$string,$color);

    $string="Piano Globale";
    $px = (imagesx($im)-7.5*strlen($string))/2;
    imagestring($im,3,$px,61,$string,$color);

    $string="Contattarli";
    $px = (imagesx($im)-7.5*strlen($string))/2;
    imagestring($im,3,$px,103,$string,$color);

    $string="Teletrasmissone";
    $px = (imagesx($im)-7.5*strlen($string))/2;
    imagestring($im,3,$px,147,$string,$color);
    imagepng($im);
    imagedestroy($im);
    ?>


    dagor Guest

  2. #2

    Default Re: Using imagePNG() !!!

    dagor wrote: 

    That is clear. Use an image tag that points to this script inside the cell instead.
    e.g. <img src="button.php">

    Regards
    Stefan

    Somebody could it help me. Thank you very much by advance. 
    Stefan Guest

  3. #3

    Default Re: Using imagePNG() !!!

    How would you activate each string to make it a clickable link?

    Stefan Rybacki:
    Stefan Rybacki <net> a écrit dans le message : 
    >
    >That is clear. Use an image tag that points to this script inside the cell instead.
    >e.g. <img src="button.php">
    >
    >Regards
    >Stefan
    >
    >Somebody could it help me. Thank you very much by advance. [/ref]

    Taxi Guest

  4. #4

    Default Re: Using imagePNG() !!!

    Taxi Driver wrote: 
    Not with PHP. It needs an HTML solution. Like the straight forward solution <a
    href=".."><img src="button1.php2></a> or using a map on the image. Whatever have a look at
    some HTML tutorials for this.

    Regards
    Stefan
    Stefan Guest

Similar Threads

  1. #45799 [NEW]: imagepng() crashes on empty image
    By amelek32 in forum PHP Bugs
    Replies: 3
    Last Post: August 12th, 02:25 PM
  2. Replies: 4
    Last Post: April 12th, 05:14 PM
  3. imagejpeg and imagepng
    By Joshua Beall in forum PHP Development
    Replies: 2
    Last Post: December 18th, 12:18 PM
  4. #25716 [Opn->Bgs]: image is broken if imagepng called from function
    By elmicha@php.net in forum PHP Development
    Replies: 0
    Last Post: October 1st, 09:11 PM
  5. #25716 [NEW]: image is broken if imagepng called from function
    By indi2000 at pisem dot net in forum PHP Development
    Replies: 0
    Last Post: October 1st, 04:21 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139