Laravel验证码图像不能在生产中工作,但开发可以

I'm using the following package johntaa/laravel-captcha to enable captcha input on my site. This works fine in my dev environment. However, in prod it can't find the image (present it as a blank).

Code

//login page
@if (Session::has('show_captcha'))
     <div class="form-group">
        <label for="captcha">Captcha</label>
        <p>{{ HTML::image(Captcha::img(), 'Captcha image')  }}</p>
        {{ Form::text('captcha',null,array('class' => 'form-control', 'placeholder' => 'Enter characters'))}}
    </div>
@endif


//HTML output snippet in dev
<p><img src="http://localhost:8888/mysite/public/captcha?730518" alt="Captcha image"></p>


//HTML output snippet in prod
<p><img src="http://mysite/captcha?262091" alt="Captcha image"></p>

Clicking on the dev link yields a result but the prod link errors to:

Call to undefined function johntaa\Captcha\imagecreatefrompng()

File location:

../vendor/johntaa/captcha/src/johntaa/Captcha/Captcha.php

More than likely your issue is that the GD module isn't installed. Do a phpinfo() to check.

If it isn't enabled do:

sudo apt-get install php5-gd

to install it (on Ubuntu).