problem with GT mod image widths... help?

If you've problems with unsupported - non official ;-) - functionalities use this forum please.
Post Reply
rtilghman
Posts: 107
Joined: Tue 1. Mar 2005, 17:22

problem with GT mod image widths... help?

Post by rtilghman »

Okay, so basically the header images GT mod is creating have too much white padding on the left side and are indented in from the text that appears beneath them. What I want is for the imgs GT mod generates to have the txt flush with the left margin of the image.

I found a post the following post which does a good job of breaking down the issue:

http://phpwcms.de/forum/viewtopic.php?p ... cb27acb99f

Unfortunately the proposed fix - to remove or alter the "+ 5" widths in the gt mod func file doesn't work. It appears that the text in the image is centered with regard to this adjustment number, and when removed it ends up eating the right edge of my imgs.

In other words if I set this number ot zero for the width I will get the text near flush with the left margin. However, the right margin ends up cutting off the right end of the last letter in my sentence.

Does anyone have a fix for this? I tried to figure out how GT mod is calculating the img widths and drawing the img, but it seemed rather complicated (like it builds a box, then figures out how to write the image in taht box) and I didn't want to totally frag my gt mod install.

Has anyone else tackled this? Anyone have an idea how I could get GT mod imgs flush with the left margin without cutting off the text on the right?

Thanks,
Rick
rtilghman
Posts: 107
Joined: Tue 1. Mar 2005, 17:22

Post by rtilghman »

I got it to work with a little mor investigating. For those interested GT basically calculates the IMG x/y, the Font x/y, finds the difference between the two, divides that value by two, and then place sthe image. The result is that the image is ALWAYS centered in the available image box.

The way to override this is simply to change the starting point of the text's placement within the image. I accomplished this by changing the following (which is line 81 of gt.func.inc.php):

Code: Select all

//****** EDIT - start set to 0, original commented out ********
	$font_start_x = 0; 		//($im_width - $font_width)/2; 
	$font_start_y = (($im_height - $font_weight)/2) + ($size/2);
The effect is that the text is always placed at the perceived "zero" x position... which will vary somewhat for letter spacing, etc., and for different letters in the same font, but its much better than previously.

You can then use the "+ #" section cited previously to increase/decrease the width and height of the font image. I found I still needed some padding in the width section to keep the image from eating the right side of my font.

To the original author, the ability to control image alignment and padding within the script appears be quite simply and would be a HUGE value add. I'm imagining that with just a few more variables on the front end of the style section you could easily add in control over the Font Start X (left padding), Font End X (right padding), Font Start Y (top padding), and Font End Y (bottom padding).

Best,
Rick
Post Reply