|
|
|
|
![]() ![]() |
May 9 2008, 08:32 PM
Post
#1
|
|
|
Member [ Level 1 ] Group: [HOSTED] Posts: 36 Joined: 28-August 07 Member No.: 24,433 |
I dont know if someone already made a topic like this, however it's not hard to understand if you can php,
as many know we need to start a php script with CODE <?php and end with CODE ?> to make a image you need a image type, I choos .png because its much cleaner then .jpg CODE header("Content-type: image/png"); for the background for the image we need this code CODE $image = imagecreatefrompng("http://www.imagefilez.com/out.php/i252132_Userbar.png"); if we wont a text in the image we need a font color, we get our font color from HEX values CODE $font_white = imagecolorallocate($image, 255, 255, 255); if u wont a text that can bee changes when the file is created and dont wont to open the file use this CODE $string = $_GET["text"]; then CODE imagestring($image, 2, 12, 3, "Ice Fury", $font_white); imagestring($image, 2, 84, 3, $string, $font_white); to save space we use this code CODE imagepng($image); imagedestroy($image); when we finnish the code should look like this CODE <?php header("Content-type: image/png"); $image = imagecreatefrompng("http://www.imagefilez.com/out.php/i252132_Userbar.png"); $font_white = imagecolorallocate($image, 255, 255, 255); $string = $_GET["text"]; //($image, fontsize, rightindent, downindent, data, txtcolour) imagestring($image, 2, 12, 3, "GD", $font_white); imagestring($image, 2, 84, 3, $string, $font_white); imagepng($image); imagedestroy($image); ?> path to file "../image.php?text=hello" now is hello writed on the image Hope you like it This post has been edited by Normano: May 9 2008, 08:33 PM |
|
|
|
May 11 2008, 11:00 AM
Post
#2
|
|
|
Super Member Group: [HOSTED] Posts: 763 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 |
Thanks for this simple and easy to follow code, i'm sure it would help to someone, i just test it and works fine (EDIT: It works fine only when i use an image located on my domain instead of yours.)
Is it possible that the generated image includes hyperlinks with the text??? If it is true how you can do it??? What kind of security problems we can get??? Best regards, This post has been edited by TavoxPeru: May 11 2008, 11:35 AM |
|
|
|
May 13 2008, 07:05 PM
Post
#3
|
|
|
Member [ Level 1 ] Group: [HOSTED] Posts: 36 Joined: 28-August 07 Member No.: 24,433 |
Thanks for this simple and easy to follow code, i'm sure it would help to someone, i just test it and works fine (EDIT: It works fine only when i use an image located on my domain instead of yours.) Is it possible that the generated image includes hyperlinks with the text??? If it is true how you can do it??? What kind of security problems we can get??? Best regards, You can't hyperlink generated images because its a png file, in some forums it not allowable to ahve .php generated images files, put a ".htaccess" file in the directory with this code CODE RewriteEngine On RewriteRule ^([^/]*)\.png$ /path to file/gd.php?text=$1 [L] now the you can come to ur generated image with this url .../yourtext.png |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 13th October 2008 - 01:14 AM |