Ok, I'm at a complete loss. I'm adding image upload functionality to my custom module, so I added imageapi to my devel(mac) machine and the production server(sles10) both have gd2 installed as confirmed by phpinfo.php and drupal. My module manipulates the image correctly on the mac but on the server it produces the following warnings..
warning: call_user_func(_image_desaturate) [function.call-user-func]: First argument is expected to be a valid callback in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 277.
warning: Division by zero in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 155.
warning: Division by zero in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 159.
warning: Division by zero in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 159.
warning: call_user_func(_image_resize) [function.call-user-func]: First argument is expected to be a valid callback in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 226.
warning: call_user_func(_image_close) [function.call-user-func]: First argument is expected to be a valid callback in /sitadmin/www/htdocs/nonsecure/sites/all/modules/imageapi/imageapi.module on line 311.
if it matters (I don't think it does) this is some of the code
$snap = file_check_upload('pi_pic');
$snap->filename = upload_munge_filename($snap->filename);
$snap_file_name = $prog . "/". $snap->filename;
$pic_path = PIC_PATH . $prog;
$file = file_save_upload($snap, $pic_path );
$image = imageapi_image_open ($file->filepath);
imageapi_image_desaturate($image);
imageapi_image_scale_and_crop($image, 38, 52);
imageapi_image_close ($image, $file->filepath);
if ($file) {
if (image_get_info($file->filepath)) {
drupal_set_message(t('New image saved.'));
} else {
file_delete($file->filepath);
drupal_set_message('Uploaded file does not appear to be a valid image file. Please try again.');
}
}It looks to me that the complete function name is not getting called (imageapi_gd_image_desaturate) so I figured maybe the toolkit (imageapi_gd) wasn't stored as a variable in the DB so I checked both and it's there in each.
drupal v5.7 imageapi 5.x-1.1 imagecache 5.x-2.0
Any help/insight into my problem would be greatly appreciated. Thank you
Comments
Comment #1
dopry commentedphp4 or php5, on which servers? did you set up an image toolkit and configure it? I think in php4 I was having a similar bug...
Comment #2
lipcpro commentedThe devel machine is a mac running MAMP Php 5.2.3, Apache 2.0.59, MySql 5.0.41, GD 2.0.34
The production server is ia64 multiprocessor running Sles 9 Php5.2.4, Apache2.2.4, MySql 5.1.2, GD 2.0.34
I thought I had, admin>settings>image-toolkit reports
on both machines and the variables table on each has imageapi_gd set as the toolkit, I did notice that in my code the imageapi_image_open function works but the next 3 fail
Comment #3
dopry commentedumm in the imageapi_gd module enabled? It seems like it isn't....
Comment #4
lipcpro commentedIt is
Comment #5
lipcpro commentedDopry, I've resolved this and I must apologize most profusely. It seems that my client did have the gd library installed however he was using a deprecated flag for compiling php (--with-jpg should have been --with-jpg-dir=) as per http://us.php.net/manual/en/image.installation.php so there was no way to process images built into that instance of php.
Needless to say all is well now and I just thought I'd post it in case anyone else came across the same problem.
I hope this helps someone else but I doubt very many people would have compiled php without jpg configured properly.
I want to thank you again for an excellent mod.
lipcpro