GD image generating bug

I'm using GD to generate images on the fly for title images on the page. There are over 100 images generated at the moment, the vast majority of which work great.

Recently we found certain titles were breaking the image creation where a large horizontal space was inserted between 2 characters.

The font being used for image generation is Interstate, and following are some examples of the titles working, along with an example of a broken one. In the case of the broken title it was the characters "JB" near each other that broke it. Flipping the characters around or having any number of characters between them results in the image being generated correctly.

As you can see from the examples the titles work with both short and long portions of text, it's just that one example that breaks it so far, really starting to confuse me and suspecting a bug in either the font file or GD, any suggestions?

Code:

private function GenerateImage() { $height = 31; $width = $this->Width; $x = 10; $y = 20; $font_size = 10; $text_colours = $this->ToRGB($this->TextColour); $background_colours = $this->ToRGB($this->BackgroundColour); $image = imagecreatetruecolor($width,$height); $fg_color = imagecolorallocate($image,$text_colours[0],$text_colours[1],$text_colours[2]); $bg_color = imagecolorallocate($image,$background_colours[0],$background_colours[1],$background_colours[2]); imagefill($image,0,0,$bg_color); imagettftext($image,$font_size,0,$x,$y,$fg_color,$this->Font,strtoupper($this->Title)); return imagepng($image,$this->FilePath,9); }

-------------Problems Reply------------

Corrupt font was to blame

Category:php Views:1 Time:2009-06-16
Tags: php gd

Related post

  • TFS 2010 set bug work item severity after build failure 2011-07-12

    I'm experiencing a problem with the severity of the bug work items generated by me builds occasionally failing while using TFS 2010 (after checking in bad sources of course). My boss has decided that a build failure for my project should rank 2nd mos

  • Bugs with jquery.live()? 2011-09-29

    Can anyone explain to me what's going on? http://jsfiddle.net/K5yvp/2/ So the way to "achieve" the bugs is : Click Show Parent or Show Parent 2 Click Next to alert Click Hide to hide (I even remove the contents with html('')) Click Show Parent or Sho

  • sequence generator and UserType 2012-03-01

    I have a sequaance generator <id name="idPersistent" type="objectID" column="aa_id"> <generator class="sequence"> <param name="sequence">lab_seq</param> </generator> </id> objectID is my own UserType. I got error j

  • Bugs with Simple file operations 2013-05-03

    How is it that bugs have been introduced that were not an issue in twenty-ish years of Windows, and furthermore, these bugs have continued throughout the development cycle, beyond beta tests and consumer previews and now months into release! Simple o

  • Menu Accelerator Keys Not Showing Up (Delphi 2009) 2008-11-11

    I've tried my best and cannot figure out what happened here. It worked fine in Delphi 4. After upgrading to Delphi 2009, I don't know if this is the way it is supposed to work, or if it's a problem: This is what my program's menu looks like in Design

  • Best Practice: ByRef or ByVal? in .Net 2008-11-14

    What are the things to consider when choosing between ByRef and ByVal. I understand the difference between the two but I don't fully understand if ByRef saves resources or if we even need to worry about that in the .Net environment. How do you decide

  • How to define an object whose address is null? 2009-01-16

    I am wondering how I can define an object in C whose reference will be null? // definition of foo ... void * bar = &foo; // bar must be null There is some ways I could find to do it, but none fit my needs. __attribute__((weak)) extern int foo; //

  • Are there any more original, more functional Haskell web-frameworks? 2011-01-04

    I looked at Haskell web frameworks like Snap and Yesod. Most seem to implement an MVC-ish approach reminding me of web frameworks like Ruby on Rails. Yes, MVC can be achieved with FP, but IMHO it doesn't show the great advantages of an FP approach. A

  • Minimize HTML page load time if it contains image icons 2011-04-11

    I want that my html page loads faster as it can. So I'm trying to put all CSS styles into the same .css file and all JavaScript code to the one .js file. How my colleagues told me it makes web page load faster. I want to ask some questions about it.

  • ActiveAdmin Error: no superclass method `buttons' 2012-04-10

    I'm starting with Rails (and I'm also new with Ruby -coming from Python-) and I'm currentrly trying to setup ActiveAdmin for Rails 3.2.3 (Ruby 1.9.3). I'm following this guide but I was not able to run it properly. When I run the rails s command visi

  • Casting or Parsing of Text in vb.net 2012-04-20

    in vb, you can use text which is in textbox instead of numerical expressions. I mean, if I write 50 in textbox1 and also I can write like that code: Dim result As Double = TextBox1.Text + 0.4 as you see, I didnt convert any type but it works in vb.ne

  • some folders did not transfer over to outlook this is a hassle as they had important info 2013-01-07

    some folders did not transfer over to outlook this is a hassle as they had important info, switched back to hotmail and they are still missing --------------Solutions------------- Have you tried recovering them? To recover your email do the following

  • Which apps should I NOT install on my Lumia 920? 2013-03-24

    Hi there! Recently I had a syncing problem since my Lumia 920 wouldn't sync my Live mail inbox after installing the Skype app. http://answers.microsoft.com/en-us/winphone/forum/wp8-wpemail/lumia-920-wont-sync-my-live-mail/807142ad-eb06-41cf-8180-83fe

  • Blue screen with watchdog.sys__ 2013-09-14

    Getting frozen computer when on the internet with blue screen with error message containing phrase: watchdog.sys - address BA458925... --------------Solutions------------- Hi MIRA11228, · Which browser you are using? · Did you make any software or ha

  • dimming arrays vba 2014-02-15

    Hello, I have this sub in a module, but I was wondering if this is the best practice for dimming arrays. This sub is can be called many times whilst the book is open and all the arrays will get a new set of values each time a button (10, on a sheet)

  • Stop code 0x0000008E (0xE0000001,0xBA4A8925,0x8B0D6820,0x00000000) 2014-10-15

    My PC has just started freezing up and sending me to a blue screen when I try to watch a video. The blue screen has the following messages: STOP code 0x0000008E (0xE0000001,0xBA4A8925,0x8B0D6820,0x00000000) watchdog.sys address BA4A8925base at BA4A80

  • usability Challenge to Microsoft 2015-03-09

    I would like to challenge Microsoft to put MSFT Surface to use following simple steps of programming a store on Surface using Visual Studio 2010 or higher. The challenge consists of reading the instruction documents and performing the steps as sugges

  • How can I generate a FindBugs report that shows me the bugs removed between two revisions in the bug database? 2010-04-14

    I am attempting to execute a combination of the FindBugs commands filterBugs and convertXmlToText, against a bug database that I created, to generate a report that shows me the all of the bugs removed between two revisions of the system that I am wor

  • How to know the line of a bug in a spring generated bean? 2010-04-15

    I've got a website build with Spring and jpa (by hibernate). I've got a bug and I don't know how to identify the line where the bug appears. I can't debug it on my ide because it's a live version (all runs fine in local). I've got log which says: o r

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.082 (s). 11 q(s)