Hi,
I think that due to changes in the image module, the img_assist in entering a null node id in the files table.
To fix this problem, this line needs to be modified in img_assist.module:
image_insert($node->nid, $size['label'], file_create_path($destination));
by this:
_image_insert($node, $size['label'], file_create_path($destination));
(now the function takes the whole node class, instead of just the id)
Failure to do this change will leave the dbase corrupted.
I notice this error with latest version of img_assist and image module (downloaded today)
-Filipe
Comments
Comment #1
jmiccolis commentedThank you Filipe for this fix.
This is a VERY CRITICAL bug. If left un-fixed dead rows are created in your datase every time an img_assist created image is loaded. This will lead to serious database bloat, and can cripple a server.
+1 on Felipe's fix
Comment #2
bomarmonk commentedDoes this patch need to be made to the 4.7 version, or is this just with CVS? It sounds serious enough, I want to be certain. Thanks for any additional clarification.
Comment #3
benshell commentedI just patched the CVS and 4.7 versions.
Note: it's not really that serious -- just go into your database and delete records in the files database that has a NID of 0. Then clear your cache table and you should be fine. This bug was affecting one of my sites too.
Commentary: This is what frustrates me about Drupal development -- things are always changing that affect my work. A few months ago when I "finished" the 4.7 version of img_assist this was not a bug. The function _image_insert() accepted the $nid, not the full $node, as a parameter. But, then the image.module changed and caused a problem for img_assist. Img_assist is especially tough to maintain because it relies on the image.module, the tinymce.module, and the official distribution of TinyMCE. When any of these projects change, img_assist suffers.
Comment #4
bomarmonk commentedThanks for your help with this. The img_assist module now works much, much better thanks to your efforts and improvements. I've been with this module nearly since its inception, and you really have put some nice finishing touches on it (there was a time before you came along where it just didn't work). Thanks again!
Comment #5
bomarmonk commentedAny idea if these errors are related to img_assist and this recent change to the image module? I get the following error when resubmitting an edited flexinode:
imagedestroy(): supplied argument is not a valid Image resource in C:\Program Files\xampp\htdocs\mysite\includes\image.inc on line 229.
imagegif(): supplied argument is not a valid Image resource in C:\Program Files\xampp\htdocs\mysite\includes\image.inc on line 300.
imagecopyresampled(): supplied argument is not a valid Image resource in C:\Program Files\xampp\htdocs\mysite\includes\image.inc on line 226.
Comment #6
benshell commentedI don't think flexinode uses img_assist in any way, so img_assist shouldn't have anything to do with that error. The line of code that changed is only used for img_assist.
Comment #7
benshell commented