base64图像不显示

I am using Grégoire's PHP Captcha library, on local host, it is working fine, as of creating images, and sending to browser. But when same code is on remote server, Captcha Image is not being displayed client side. Since in both cases each image request is responded with around 20kB of data, I am sure the image is being downloaded. And from the looks of it, it seems a valid base64 of an image. the only difference I have noticed is that when logging the base64 string, it is usually shorter, around 8kB, while the base64 from localhost is just as much as the real image, ~20kB. But with my knowledge, I don't know how to use this information. Any Guidelines?

snippet of code:

$captcha = new Gregwar\Captcha\CaptchaBuilder;
$captcha->build(
Config::get('CAPTCHA_WIDTH'),
    Config::get('CAPTCHA_HEIGHT')
);
header('Content-type: image/jpeg');
$captcha->output();

Further Info:

I have used wamp on my windows 7, but installed apache2, php5 separately on remote ubuntu 14.04.

Localhost: apache 2.4.9 , php 5.5.12

Remote Server: apache 2.4.7 , php 5.5.9

In both cases No error is being generated whatsoever.

a working base64 from localhost:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPU ... iiigAooooAKKKKACiiigD//2Q==

which is usually around 20 kbytes long.

a not-working base64 from remote server:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPU ... I0vQ7A

which is usually around 8 kbytes long.

Edit: I have fixed it with a workaround, but still not sure about the reason of the problem. here it goes: In the registrationView.php, I had a tag, of which, the 'src' attribute was set to this non-existing url that triggers the CaptchaBuilder code. So maybe this method does not work on remote config, because of the connection delay?? and what I did is that I replaced the 'src' tag with an ajax request that WAITS for the success and then loads the base64data. If anybody could give a confident comment on this suspicion, hopefully we get to the answer..