Posted by Julien PHAM on February 20, 2006 at 7:36am
9 followers
Jump to:
| Project: | Flexinode |
| Version: | 4.7.x-1.x-dev |
| Component: | Field type: image |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Julien PHAM |
| Status: | postponed (maintainer needs more info) |
Issue Summary
Hi,
So I have a flexinode with a picture field in it. I write an article using this flexinode object, and when I click on "submit" I get many error messages.
* warning: Division by zero in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 125.
* warning: imagecreatetruecolor(): Invalid image dimensions in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 225.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 226.
* warning: imagejpeg(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 300.
* warning: imagedestroy(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 229.
* warning: Division by zero in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 125.
* warning: imagecreatetruecolor(): Invalid image dimensions in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 225.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 226.
* warning: imagejpeg(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 300.
* warning: imagedestroy(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 229.
* warning: Division by zero in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 125.
* warning: imagecreatetruecolor(): Invalid image dimensions in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 225.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 226.
* warning: imagejpeg(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 300.
* warning: imagedestroy(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 229.
* warning: Division by zero in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 125.
* warning: imagecreatetruecolor(): Invalid image dimensions in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 225.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 226.
* warning: imagejpeg(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 300.
* warning: imagedestroy(): supplied argument is not a valid Image resource in /homepages/23/d154239500/htdocs/min/includes/image.inc on line 229.The article is still created, the image is uploaded to server, and if I look into the database field, for the image field I get:
nid: 30
field_id: 8
textual_data: chat.gif
numeric_data: 0
serialized_data: O:8:"stdClass":8:{s:8:"filename";s:8:"chat.gif";s:8:"filepath";s:14:"files/chat.gif";s:8:"filemime";s:9:"image/gif";s:5:"error";i:0;s:8:"filesize";i:3635;s:6:"source";s:11:"flexinode_8";s:9:"smallpath";s:17:"files/chat_sm.gif";s:9:"thumbpath";s:17:"files/chat_th.gif";
Comments
#1
I have the same issue, it says its something to do with the image.inc [has that changed for 4.7 it looked pretty similar to 4.6.5 to me, but i'm no expert].
Everything works fine [image uploaded and content inserted] apart this error.
thanks
Tom
#2
Hi, right i think i've sorted this one.
the problem was with the image size options form [flexinode_field_image_config function], the options were missing a closing ']', so the fields were not being read correctly thus causing the error.
i just added the the missing ']' to each option and it seems to have fixed the errors.
replace your flexinode_field_image_config function [line 137 i think] with this:
function flexinode_field_image_config($field) {
if (!isset($field->options)) {
$field->options = array(
1 => '800x600',
2 => '512x384',
3 => '100x100',
4 => 100,
);
}
$form['tester'] = array(
'#type' => 'fieldset',
'#title' => t('Options'),
'#description' => t('Options for the image upload.'),
);
$form['tester'][] = array('options][1]' => array(
'#type' => 'textfield',
'#title' => t('Maximum picture dimensions'),
'#default_value' => $field->options[1],
'#description' => t('Maximum dimensions for pictures. Format: WidthxHeight'),
));
$form['tester'][] = array('options][2]' => array(
'#type' => 'textfield',
'#title' => t('Preview dimensions'),
'#default_value' => $field->options[2],
'#description' => t('Dimensions for auto-created preview (scale will be preserved). Format: WidthxHeight'),
));
$form['tester'][] = array('options][3]' => array(
'#type' => 'textfield',
'#title' => t('Thumbnail dimensions'),
'#default_value' => $field->options[3],
'#description' => t('Dimensions for auto-created thumbnail (scale will be preserved). Format: WidthxHeight'),
));
$form['tester'][] = array('options][4]' => array(
'#type' => 'textfield',
'#title' => t('Maximum picture size'),
'#default_value' => $field->options[4],
'#description' => t('Maximum picture file size, in kB.'),
));
return $form;
}
i don't know how to make a patch so if someone else out there wants to do that i'm sure lots of people would appreciate it.
thanks
Tom
#3
sorry about the lack of code tags in my above post, for some reason it didn't work.
tom
#4
please provide a real patch. http://Drupal.org/diffandpatch
#5
#6
I tried this patch, but still have the same errors...
#7
Oops... I din't mean to change the component... changing back to field type... but shouldn't this be code, as it relates to the inclusion of images in the body of the flexinode, etc? This isn't directly related to a field type, right?
#8
Can we get an update on this? Does this work? Will it be committed? I've tried this again, but I am still getting the same errors when updating a flexinode with an image field (ignore the stuff about general versus field comments, I think this is related directly to the field_image.inc file, as the errors occur with flexinodes whether or not they have inline images-- the common denominator is the image field for flexinode).
The above change doesn't make anything worse, so should the file be patched with this, even though it doesn't take care of these errors:
imagegif(): Unable to open 'files/AlpineSeal_th.gif' for writing in /gov/mysite/WWW/includes/image.inc on line 300.
imagedestroy(): supplied argument is not a valid Image resource in /gov/mysite/WWW/includes/image.inc on line 229.
imagegif(): supplied argument is not a valid Image resource in /gov/mysite/WWW/includes/image.inc on line 300.
imagecopyresampled(): supplied argument is not a valid Image resource in /gov/mysite/WWW/includes/image.inc on line 226.
imagecreatetruecolor(): Invalid image dimensions in /gov/mysite/WWW/includes/image.inc on line 225.
Thanks for any help with this. I can create a patch, if anyone can post code that will fix these errors. Thanks.
#9
Sorry but just to be thorough, bomarmonk...
in that last error message, are you sure that "nobody" (or whatever user httpd runs as) has read+write+modify permissions on the folder "files"?
#10
Right now my file permissions are definitely open to that...
#11
There is still no patch.
#12
At the top of field_image.inc there is this comment:
// FIXME: when editing (updating, changing) flexinode node flexinode_field_image_insert() is called and thumbnails/previews are generated// even if no new file was uploaded... don't know how to fix that...
This seems to be the cause of these errors.
flexinode_field_image_insert() calls flexinode_field_image_make_smaller() and this calls image_scale().
image_scale() is in /includes/image.inc where all the errors are seen.
#13
Mystery solved!
In Drupal 4.6 image fields have only two options: "Maximum picture dimensions" and "Maximum picture size".
In Drupal 4.7 there are four options: "Maximum picture dimensions", "Preview dimensions", "Thumbnail dimensions" and "Maximum picture size".
The update process will set the "Preview dimensions" the value of the old "Maximum picture size" and leave the last two empty. Also, the dimension should be of the format WidthxHeight but it is a simple number now.
So, just go to administer / content, content types and edit the image fields and set proper options.
The update method inside flexinode.install should be fixed I guess (if possible).
#14
can you be more specific?
I can't find anything specific to what you're saying:
"go to administer / content, content types and edit the image fields and set proper options."
(what "image fields" are you refering to? where?)
closest i've found to "Maximum picture dimensions", "Preview dimensions", "Thumbnail dimensions" and "Maximum picture size".
is
Home » administer » settings » image
shows:
Label Width Height
thumbnail 100 100
preview 640 640
and there are 3 empty rows below that...
#15
Fix described in #13 confirmed for me. I simply re-edited the image fields in my flexinode forms, and checked to make sure the size parameters were present, and in the expected format. Once I did that, everything seemed to work just fine.
#16
#17
http://drupal.org/node/65564 was marked duplicate of this issue.
#18
http://drupal.org/node/43436 was marked duplicate of this issue
#19
I committed quite some changes that fix all issues on a new installation. However, I am quite sure that an upgrade from 4.6 to 4.7 will cause trouble, since the no required config fields did not yet exsist ni 4.6.
For that, I would live to receive a database dump from flexinode_field in 4.6 format. IF you have some, it would be of great help if you shared that.
#20
with al the fixes i think the priority can be brought down.
#21