SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
May 14, 2009, 03:24 #1
- Join Date
- May 2009
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help Needed to Insert Dynamic Text into Downloadable Picture
Hi everyone, this is my first post after being recommended to these forums by a friend of mine, so I hope to be on here more often, helping where I can.
I would really appreicate some help with something I actually have no idea how to start. I want users of my forum to be able to create signature images which are consistent. E.g. I want the same stock image with the text changing.
I would like to have an html form which is filled in, which when is sent loads an image with the text they have entered.
I have seen this done elsewhere on the web with "newspaper headline generators"
Does anyone know of any tutorials or scripts out there which would help me.
Many thanks
-
May 14, 2009, 03:41 #2
- Join Date
- Oct 2008
- Location
- London
- Posts
- 862
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You need to be more specific. Do you know how to create an HTML form and process it in PHP? If so then use GD library or ImageMagick to overlay the text on an image.
If not then: a) do you want to learn or b) do you want to just get it done?
a) Start with learning HTML and PHP, there are many tutorials out there. Just Google it.
b) Pay someone to do it for you.Pawel Decowski (you should follow me on Twitter)
-
May 14, 2009, 03:45 #3
- Join Date
- May 2009
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi Paul, thanks for your reply. I would prefer to learn how to do it, I've spent time trying to find tutorials but can't find any. If you know of any please let me know.
I know how to create forms, my html is fine, but I don't know how to use php to process it and render it with ImageMagick.
-
May 14, 2009, 03:50 #4
- Join Date
- Oct 2008
- Location
- London
- Posts
- 862
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, I don't know of any tutorials but this is book is great for start:
PHP and MySQL Web DevelopmentPawel Decowski (you should follow me on Twitter)
-
May 14, 2009, 15:23 #5
- Join Date
- May 2009
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Book has been ordered :-)
In the meantime, I have had a play and have some code which I have been trying to build. I'm not sure what I am doing wrong (apart from not using an array). I'm getting an error stating that
"The image "" cannot be displayed, because it contains errors."
Any help would be most appreciated.
Code:<?php header("Content-Type: image/PNG"); $image = ImageCreateFromPNG("test.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'arial.ttf'; $fontSize = "10"; $fontRotation = "0"; if (isset($_GET['line1'])) { $line1 = $_GET['line1']; } if (isset($_GET['line2'])) { $line1 = $_GET['line2']; } if (isset($_GET['line3'])) { $line1 = $_GET['line3']; } if (isset($_GET['line4'])) { $line1 = $_GET['line4']; } ImageTTFText($image, $fontSize, $fontRotation, 12, 24, $colorShadow, $font, $line1); ImageTTFText($image, $fontSize, $fontRotation, 10, 20, $color, $font, $font, $line1); ImageTTFText($image, $fontSize, $fontRotation, 12, 24, $colorShadow, $font, $line2); ImageTTFText($image, $fontSize, $fontRotation, 10, 20, $color, $font, $font, $line2); ImageTTFText($image, $fontSize, $fontRotation, 12, 24, $colorShadow, $font, $line3); ImageTTFText($image, $fontSize, $fontRotation, 10, 20, $color, $font, $font, $line3); ImageTTFText($image, $fontSize, $fontRotation, 12, 24, $colorShadow, $font, $line4); ImageTTFText($image, $fontSize, $fontRotation, 10, 20, $color, $font, $font, $line4); ImagePng ($image); imagedestroy($image); ?>
-
May 14, 2009, 15:30 #6
- Join Date
- May 2009
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Forgot to explain, that I have a form which uses get to place parameters in the URL of that php file. The script is supposed to take the parameter data out of the URL and overlay over the image.
Thanks :-)
-
May 15, 2009, 01:56 #7
- Join Date
- Oct 2008
- Location
- London
- Posts
- 862
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Comment out the Content-type header and you will see that PHP throws some errors
hence your browser complains that the image is corrupted (because it's actually sent some error message rather than an image).
Pawel Decowski (you should follow me on Twitter)
Bookmarks