T3A guy Posted June 22, 2009 Report Posted June 22, 2009 I need some help with image editing in PHP. Their are three parts of the image editing I need help with. Going fromhttp://cvcl.mit.edu/hybrid/cat2.jpgto(adding text) fromhttp://cvcl.mit.edu/hybrid/cat2.jpgto(adding another image) fromhttp://cvcl.mit.edu/hybrid/cat2.jpgto(inverting or changing colors) Thanks for any help in advance.
iBotPeaches Posted June 22, 2009 Report Posted June 22, 2009 ImageString($image, 1, $x, $y, 'Text', $text_color);Send it the image in that var, and give it the x and y coordinates of the string, and make a variable to the color and thats text_color //Image on top $overlay = 'gamerpic.php'; //Background $image = imagecreatefrompng('kjigd3.png'); //Image on top $oimg = imagecreatefrompng($overlay) //Output imagettftext($oimg, 20, 0, ($img_w/2 - $pos_activity[2]), 50); This will put one image on top (take from google, could be wrong) Inverting is directly from the php manual here. <?php header("Content-Type: image/jpeg"); $image = imagecreatefromjpeg("flower_normal.jpg"); $image_width = imagesx($image); $image_height = imagesy($image); for ($h = 0; $h < $image_height; $h++) { for ($w = 0; $w < $image_width; $w++) { $colors = imagecolorsforindex($image, imagecolorat($image, $w, $h)); $colors['red'] = 255 - $colors['red']; $colors['green'] = 255 - $colors['green']; $colors['blue'] = 255 - $colors['blue']; $new_color = imagecolorallocate($image, $colors['red'], $colors['green'], $colors['blue']); imagesetpixel($image, $w, $h, $new_color); } } imagejpeg($image, NULL, 80); ?> 1
T3A guy Posted June 22, 2009 Author Report Posted June 22, 2009 $image = imagecreatefrompng('kjigd3.png'); Is the code I needed the most. I didn't know how edit an image that was already made. Thanks.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now