Page 1 of 1

Create a php image editing script.

Posted: Thu Mar 18, 2004 3:41 pm
by KrisH
I am trying to create a script that lets a user input text and font's and fon't size as option, then after the click post it updates a image with that feature as in example:

A user fill out a simple form after s/he click submit it does a $_POST ... I am trying to find out a way to grab that $_POST and input it onto the image using a GD function call or a php function class call :) correct me if i am wrong, i am new at this programming with function :)

Posted: Thu Mar 18, 2004 3:43 pm
by KrisH
I am using this guy class http://evoluted.net/archives/000011.php

Also look at this add text to image example at the bottom i am trying to do that!

Posted: Mon Mar 22, 2004 3:40 pm
by KrisH
anyone?

Posted: Mon Mar 22, 2004 4:02 pm
by dull1554
This is what i use to overlay text on an image....

Code: Select all

<?php
   header("Content-type: image/png");
   $string = $_POST['image_string'];//text to be imposed on the image
   $im    = imagecreatefrompng($_POST['path_image']);//path/filename of image
   $color = imagecolorallocate($im, 0, 0, 0);//color(0-255,0-255,0-255)
   $image_width = (imagesx($im) - 7.5 * strlen($string)) / 2;
   $font_size = $_POST['font_size'];//font size
   $image_height = imagesy($im) / 2 - $font_size;
   imagestring($im, $font_size, $image_width, $image_height, $string, $color);
   imagepng($im);
   imagedestroy($im);
?>
this GD script will center the text on the image