Writing text on an image
Moderator: General Moderators
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
Writing text on an image
How can I write text on an image?
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
I was searching and didnt find nothing what im trying to do.
everything I found creates the image. i want to use an image stored on my Web Server, say a star galaxy background. or an image named background.png or background.jpg
this is what I found.
i dont want to create a new image. i want to use a previous image then write on that image.
everything I found creates the image. i want to use an image stored on my Web Server, say a star galaxy background. or an image named background.png or background.jpg
this is what I found.
i dont want to create a new image. i want to use a previous image then write on that image.
Code: Select all
<?php
if($_POST['text2write']){
$im = imagecreate(100, 30);
// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
imagestring($im, 5, 0, 0, $_POST['text2write'], $textcolor);
header("Content-type: image/png");
imagepng($im);
exit();
}- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
You have to create a new image, but you can use an existing image as the base for this new image. imagecreatefrompng() for example.
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
just found that at php.net ^_^ thanks.feyd wrote:You have to create a new image, but you can use an existing image as the base for this new image. imagecreatefrompng() for example.
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am