Thursday , November 21 2024

Convert Text To Image

You can convert text to image by using this php code. You then download the image file.

<?php
header(“Content-type: image/png”);
$string = $_GET[‘text’];
$im = imagecreatefrompng(“images/button.png”);
$color = imagecolorallocate($im, 255, 255, 255);
$px = (imagesx($im) – 7.5 * strlen($string)) / 2;
$py = 9;
$fontSize = 1;

imagestring($im, fontSize, $px, $py, $string, $color);
imagepng($im);
imagedestroy($im);
?>

About admin

Check Also

Resize Images in php

Creating thumbnails of the images is required many a times, this code will be useful …

Leave a Reply