Hi
Ive been trying to enable the CAPTCHA images.
I get this message:
"Images cannot be generated, because your PHP installation's GD library has no JPEG support."
My PHP configure:
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--enable-soap' '--with-openssl' '--with-gd' '--with-jpeg-dir=/usr' '--with-ttf' '--with-freetype' '--enable-gd-native-ttf'
My PHP version is 5.2.3
Working on Linux.
Drupal 5.5
downloaded gdlib, jpeglib is available at /usr.
Other ideas?
I've got this thread going on too: http://drupal.org/node/205298#comment-675529 but still no luck.
Thank in advance,
Rocky

Comments

soxofaan’s picture

could you execute the following php on your server, for example by creating a new page with the "PHP code" input format:

if (function_exists('imagegd2')) {
  var_export(gd_info());
}
$fs = array('imagejpeg', 'imagecreatetruecolor', 'imagedestroy',
  'imagecolorallocate', 'imagefilledrectangle', 'imagecolorat', 'imagesetpixel',
  'imageline', 'imagefontwidth', 'imagettfbbox', 'imagestring', 'imagettftext',
);
foreach($fs as $f) {
  print "$f: ". var_export(function_exists($f), TRUE) .'<br />';
}

and post the result?

(from http://drupal.org/node/183608#comment-614940)

rockyrackoon’s picture

sure - here's the result:

array ( 'GD Version' => 'bundled (2.0.34 compatible)', 'FreeType Support' => true, 'FreeType Linkage' => 'with TTF library', 'T1Lib Support' => false, 'GIF Read Support' => true, 'GIF Create Support' => true, 'JPG Support' => false, 'PNG Support' => true, 'WBMP Support' => true, 'XPM Support' => false, 'XBM Support' => true, 'JIS-mapped Japanese Font Support' => false, )
imagejpeg: false
imagecreatetruecolor: true
imagedestroy: true
imagecolorallocate: true
imagefilledrectangle: true
imagecolorat: true
imagesetpixel: true
imageline: true
imagefontwidth: true
imagettfbbox: true
imagestring: true
imagettftext: true

what now?

soxofaan’s picture

'JPG Support' => false
imagejpeg: false

You have no jpeg support. I'm not very familiar with compiling PHP, so I can't help you with this.

But you seem to have PNG support.
If you are not afraid of hacking, you could change image_captcha to work with PNG instead of JPEG.
at first sight, the only changes in "image_captcha.module" you should do are:
replace "imagejpeg" with "imagepng" (globally in the source code)
and replace 'drupal_set_header("Content-type: image/jpeg");' with 'drupal_set_header("Content-type: image/png");' (around line 400)

try this and report your findings (and post a patch)
I have no time right now to do it myself

rockyrackoon’s picture

Good job!
I've hacked it to use png and it works now.
Thanks!
what do you mean by "post a patch"?
and where can i find fonts to use with the captcha, cince it keeps warning me about the default font?

thank you anyway

rocky

soxofaan’s picture

Status: Active » Fixed

what do you mean by "post a patch"?

If you're not familiar with this, it will probably be easier to do it myself than explaining this, so nevermind ;)
If you're still interested: http://drupal.org/patch

Also note that you now have a custom version of the image CAPTCHA module, so any future upgrade of the module will overwrite your changes.

and where can i find fonts to use with the captcha, cince it keeps warning me about the default font?

There are thousands of font sites out there.
I use http://www.dafont.com often

malbrecht’s picture

if you follow the hints on your forum thread you might even get jpeg working. It's difficult to keep two seperate pleas for help under control

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.