Home > Archive > PHP Language > August 2005 > Using imagePNG() !!!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
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);
?>
| |
| Stefan Rybacki 2005-08-15, 8:59 am |
| dagor wrote:
> 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.
>
>
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.
>
> 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);
> ?>
>
>
| |
| Taxi Driver 2005-08-15, 8:59 am |
| How would you activate each string to make it a clickable link?
Stefan Rybacki:
Stefan Rybacki <stefan.rybacki@gmx.net> a écrit dans le message :[color=darkred]
>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 Rybacki 2005-08-15, 8:59 am |
| Taxi Driver wrote:
> How would you activate each string to make it a clickable link?
>
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
|
|
|
|
|