Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 07-09-2008, 11:46 AM   #1 (permalink)
All round good guy!
 
Tkey's Avatar
 
Join Date: Aug 2006
Location: East Midlands, UK
Posts: 1,426
Send a message via AIM to Tkey Send a message via MSN to Tkey Send a message via Yahoo to Tkey
Default GD - tech forums Image

You may, (or may not) have noticed the image i use in the new members area now and again. I'm getting pretty quick at creating them but, let's face it, it's getting a tad tedious.

I'm wondering if someone could shed some light on this one

Firstly, the codes.

PHP tfgenerate.php http://193.111.226.179/tfgenerate.php

Code of tfgenerate.php

Code:
<?php
header('Content-type: image/png');
$text = $_GET['text'];
$im = imagecreatefrompng ("tech forums.png");
$color = imagecolorallocate($im, 0, 0, 0);
$font = 'font.ttf';
$fontsize = 24;
$size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string
$dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text
imagettftext($im, $fontsize, 0, $dx, 35, $color, $font, $text);
imagepng($im);
imagedestroy($im);
?>
The fonts and raw PNG are in their reletive locations.

Now, we all know where I need things to go :P

Heres a sample:




Hoping CrazeD or someone can help me out

Cheers,

~ Tkey
Tkey is offline   Reply With Quote
Old 07-09-2008, 06:01 PM   #2 (permalink)
Master Techie
 
CrazeD's Avatar
 
Join Date: Feb 2006
Location: Maine
Posts: 2,648
Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: GD - tech forums Image

So, what are you trying to do exactly? You want to create an image like the one you posted using PHP?
__________________

Need website help? PM me!
CrazeD is offline   Reply With Quote
Old 07-10-2008, 11:08 AM   #3 (permalink)
All round good guy!
 
Tkey's Avatar
 
Join Date: Aug 2006
Location: East Midlands, UK
Posts: 1,426
Send a message via AIM to Tkey Send a message via MSN to Tkey Send a message via Yahoo to Tkey
Default Re: GD - tech forums Image

yeah, I think iv got the basic code up there, just im not sure how to configure the colours and get it in the right place. It's definatly working since appending &text= works perfectly. Just..... in the wrong place
Tkey is offline   Reply With Quote
Old 07-13-2008, 05:15 AM   #4 (permalink)
All round good guy!
 
Tkey's Avatar
 
Join Date: Aug 2006
Location: East Midlands, UK
Posts: 1,426
Send a message via AIM to Tkey Send a message via MSN to Tkey Send a message via Yahoo to Tkey
Default Re: GD - tech forums Image

Could you get ahold of any infomation on this CrazeD, or do you need some more info from me?

Cheers,

~ Tkey
__________________
Need website help?
PM Me

I killed my folding rig
Tkey is offline   Reply With Quote
Old 07-13-2008, 06:45 AM   #5 (permalink)
Ultra Techie
 
zedman3d's Avatar
 
Join Date: Oct 2007
Posts: 630
Default Re: GD - tech forums Image

Try using this to smooth the text (not 100% sure if it works on text or not):
PHP Code:
imageantialias($imtrue); 
As for the rest, it should work like you use GET to retrieve the users name, and the generic statement that proceeds is already in the file.

Like:

PHP Code:
$allofthetext "Hey ".$username.", Welcome to the forums..." 

__________________

My pick up line is: I know Vernong.
Trotter: "Ask all the questions you want... whatever we don't know, we'll make
up something that sounds pretty good."

*All prices are USD and ship to US and Canada*


Last edited by zedman3d; 07-13-2008 at 06:48 AM.
zedman3d is online now   Reply With Quote
Old 07-13-2008, 06:53 AM   #6 (permalink)
All round good guy!
 
Tkey's Avatar
 
Join Date: Aug 2006
Location: East Midlands, UK
Posts: 1,426
Send a message via AIM to Tkey Send a message via MSN to Tkey Send a message via Yahoo to Tkey
Default Re: GD - tech forums Image

The text smoothing you suggested did nothing
I'm not quite sure why there is such a loss of quality, since the filetype is set to PNG and the file is a PNG.

Could this be something to do with the PHP running on my server?

Cheers,

~ Tkey
__________________
Need website help?
PM Me

I killed my folding rig
Tkey is offline   Reply With Quote
Old 07-13-2008, 10:56 AM   #7 (permalink)
Master Techie
 
CrazeD's Avatar
 
Join Date: Feb 2006
Location: Maine
Posts: 2,648
Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: GD - tech forums Image

Sorry Tkey, been kind of busy.

And I still don't really know what you need help with. You seem to have code that works. Are you just trying to fix the fuzzy text?
__________________

Need website help? PM me!
CrazeD is offline   Reply With Quote
Old 07-13-2008, 12:33 PM   #8 (permalink)
All round good guy!
 
Tkey's Avatar
 
Join Date: Aug 2006
Location: East Midlands, UK
Posts: 1,426
Send a message via AIM to Tkey Send a message via MSN to Tkey Send a message via Yahoo to Tkey
Default Re: GD - tech forums Image

Sorry. Yes, basically I need to image quality fixing, then I need to sort out the positioning and colours to mach those I use in the image normally.

Cheers,

~ Tkey
__________________
Need website help?
PM Me

I killed my folding rig
Tkey is offline   Reply With Quote
Old 07-13-2008, 04:52 PM   #9 (permalink)
Master Techie
 
CrazeD's Avatar
 
Join Date: Feb 2006
Location: Maine
Posts: 2,648
Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: GD - tech forums Image

Ok, so what is tech forums.png that you reference? I don't know which parts are image and which parts are text.
__________________

Need website help? PM me!
CrazeD is offline   Reply With Quote
Old 07-13-2008, 07:15 PM   #10 (permalink)
Ultra Techie
 
zedman3d's Avatar
 
Join Date: Oct 2007
Posts: 630
Default Re: GD - tech forums Image

Okay dont go off at me, but i cant actually get that code to work. I have GD installed and everything but it throws errors galore. But obviously, its working for you so ill try to help.

Try keeping the AntiAliasing code i have. Even if its doing nothing, it cant make things worse.

Next, swap

PHP Code:
imagettftext($im$fontsize0$dx35$color$font$text); 
for

PHP Code:
imagestring($im3035$text$color
The 3 is a generic font, you can later change it with $font if it still looks odd and try it once more.
__________________

My pick up line is: I know Vernong.
Trotter: "Ask all the questions you want... whatever we don't know, we'll make
up something that sounds pretty good."

*All prices are USD and ship to US and Canada*

zedman3d is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double clicking an image opens windows photo gallery instead of preview the image djfiasco Windows Operating Systems and Software 10 03-03-2008 10:35 PM
Copying gif image Nick Web Graphics, design, digital images 10 01-08-2008 10:10 AM
Macromedia Dreamweaver Image Issue westy159 Web Graphics, design, digital images 5 12-07-2007 01:35 PM
Added 1 Gig of Ram and CPU is SLOWER!? czarnybaran5150 Building, Buying, or Upgrading High Performance PC Systems 0 08-07-2007 11:09 PM
Browser Resize image question Murdoc Programming Discussions 1 07-23-2007 03:22 PM


All times are GMT -5. The time now is 01:24 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0