Images cannot be generated, because your PHP installation's GD library has no JPEG support.

rockyrackoon - January 2, 2008 - 09:13
Project:CAPTCHA
Version:5.x-3.1
Component:Image Captcha (image_captcha)
Category:support request
Priority:normal
Assigned:rockyrackoon
Status:closed
Issue tags:Newbie
Description

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

#1

soxofaan - January 2, 2008 - 10:45

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

<?php
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)

#2

rockyrackoon - January 2, 2008 - 12:29

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?

#3

soxofaan - January 2, 2008 - 14:04

'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

#4

rockyrackoon - January 2, 2008 - 15:55

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

#5

soxofaan - January 2, 2008 - 16:45
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

#6

malbrecht - January 6, 2008 - 10:24

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

#7

Anonymous - January 20, 2008 - 10:31
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.