Jump to content

Placing a text over on image


phpmady

Recommended Posts

imagecopymerge

 

just make 1 sold image.. when it gets sold.. create the image and display that image instead of the first one..

 

unless you want to add the "sold" like ontop of the image (in html - layered) in which case.. you can just set a div with the image as it's backgound.. and with javascript display "SOLD" :)

If you want to place text dynamically over a image you could use the below code I found through google.

<?php

//PHP's GD class functions can create a variety of output image
//types, this example creates a jpeg
header("Content-Type: image/jpeg");

//open up the image you want to put text over
$im = ImageCreateFromGif("template.gif"); 

//The numbers are the RGB values of the color you want to use
$black = ImageColorAllocate($im, 255, 255, 255);

//The canvas's (0,0) position is the upper left corner
//So this is how far down and to the right the text should start
$start_x = 10;
$start_y = 20;

//This writes your text on the image in 12 point using verdana.ttf
//For the type of effects you quoted, you'll want to use a truetype font
//And not one of GD's built in fonts. Just upload the ttf file from your
//c: windows fonts directory to your web server to use it.
Imagettftext($im, 12, 0, $start_x, $start_y, $black, 'verdana.ttf', "text to write");

//Creates the jpeg image and sends it to the browser
//100 is the jpeg quality percentage
Imagejpeg($im, '', 100);

ImageDestroy($im);

?>

All you gotta do is provide the image, upload your font of choice, and change the text variable.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.