Disabling the font resizing, for a 250X100 image |
Disabling the font resizing, for a 250X100 image |
Dukessa |
Dec 4 2008, 03:56 PM
Post
#1
|
Newbie Group: Members Posts: 3 Joined: 4-December 08 Member No.: 636 |
I'm using a 250X100 image, and the text looks really ugly...I dont know why, but it has to do with the resizing.
So I'm trying to take off the resizing feature from the code. If anyone knows how to keep the resizing, but make it suitable for a 250X100 image, please let me know! Ok so I tried to comment out all the code under: CODE # Resize the text so it fits on the image if the default font # size is too large. And CODE $text_size = size_text($config, $song, $img_size); But then I get this error: CODE Fatal error: Call to undefined function get_song() in /mnt/local/home/***/signature.php on line 139 line 139 is about this stuff: CODE # First we need to get all the song information into $SONG hash for later use. # song_file has the key=value format, with new line as a separator get_song($config['song_file']); So I guess I took off too many things... ------ If I try to take off only: CODE function size_text(&$config, $song_title, $image_size) { $font_size = intval($config['font_size']); $padding = intval($config['padding']); $text_size = imagettfbbox ($font_size, 0, $config['font_file'], $song_title); while($text_size[4] > ($image_size[0] - $padding)) { $font_size -= 1; $config['text_vertical_offset'] -= 1; $text_size = imagettfbbox($font_size, 0, $config['font_file'], $song_title); } $config['font_size'] = $font_size; return (imagettfbbox($font_size, 0, $config['font_file'], $song_title)); //size, angle, name, string } ...from the resize part... then I dont get errors...but the image doesnt display (i get a red cross) Any idea? |
Myth Monk |
Dec 5 2008, 12:05 AM
Post
#2
|
Newbie Group: Members Posts: 3 Joined: 4-December 08 Member No.: 637 |
That's not resizing the image at all, just the text size.
You have a couple of options here, probably: 1) Remove the text resizing CODE # Resize the main text (if it is very long to fit the image, reduce the font size) $text_size = size_text($config, $song, $img_size); change to: CODE $text_size = imagettfbbox(intval($config['font_size']), 0, $config['font_file'], $song) or 2) Switch fonts copy another font file of your choosing into the directory (it comes with impact.ttf and lucon.ttf) and change this: CODE # This script tries to get it automatically, however if it doesn't work, set it manually $config['font_file'] = "$script_dir/impact.ttf"; # Full path of the font used to display text on the sides $config['font_mono'] = "$script_dir/lucon.ttf"; to reflect the fonts you wish to use. Again, I haven't tested this because I wrote my own PHP scripts for these purposes, but that SHOULD work |