hi, i want to combine text and image on the fly to create a jpg widget. I want to do this for a fundraising website, i will need to update the image once a day so it reflect the updated fundraising progress bar. The reason why i want a jpg (image) widget is because it is much more friendly to add to blogs, website etc.
Also GD functions: http://php.net/manual/en/ref.image.php
nikc
2010-07-10 18:13:47
I dont want to host anything on image shack. Here is an example of what i am trying to do http://www.kickstarter.com/projects/devilmaycarethemovie/devil-may-care/widget thanks for your help. If you have another idea, please let me know
NYC2012
2010-07-12 14:40:19
A:
you can do it with gd
//open up the image you want to put text over
$im = imagecreatefromjpeg($imagePath);
//The numbers are the RGB values of the color you want to use
$black = ImageColorAllocate($im, 255, 255, 255);
//The canvas's (0,0) position is the upper left corner
//So this is how far down and to the right the text should start
$start_x = 10;
$start_y = 20;
//This writes your text on the image in 12 point using verdana.ttf
//For the type of effects you quoted, you'll want to use a truetype font
//And not one of GD's built in fonts. Just upload the ttf file from your
//c: windows fonts directory to your web server to use it.
Imagettftext($im, 12, 0, $start_x, $start_y, $black, 'verdana.ttf', 'text to write');
//Creates the jpeg image and sends it to the browser
//100 is the jpeg quality percentage
Imagejpeg($im, '', 100);
ImageDestroy($im);
kgb
2010-07-10 18:23:31
this is basically what i am trying to do. do you think i can achieve that with GDhttp://www.kickstarter.com/projects/devilmaycarethemovie/devil-may-care/widget
NYC2012
2010-07-12 14:37:37
yes, you can. you need to prepare all the fonts as separate files(i see 2-3 fonts in the example), draw the text ;), draw the progress bar using 2 rectangles... everything should simple. if you have troubles with aligning "29 days to go" to the right? check out this example: http://www.webmasterworld.com/forum88/12273.htm
kgb
2010-07-12 19:39:17