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" :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.