Create a php image editing script.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KrisH
Forum Newbie
Posts: 4
Joined: Thu Mar 18, 2004 3:33 pm

Create a php image editing script.

Post 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 :)
KrisH
Forum Newbie
Posts: 4
Joined: Thu Mar 18, 2004 3:33 pm

Post 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!
KrisH
Forum Newbie
Posts: 4
Joined: Thu Mar 18, 2004 3:33 pm

Post by KrisH »

anyone?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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
Post Reply