Image files seem to be randomly disappearing (from the files table in the db, wysiwyg_imageupload_entity still has the record, but pointing to a nonexistent fid in the files table) after upload via this module. Using wysiwyg 6.x-2.1 and ckeditor. Any ideas?

Comments

obrienmd’s picture

I'm going to be watching the files table for a status = 0, but haven't seen any. Also, in looking through wysiwyg_imageupload.file.inc, I see this:

if($file->new) {
      file_set_status($file, FILE_STATUS_PERMANENT);
    }

I'll dig further, but if this is not run, is file status set to temp? Is there a reason $file->new would not be true?

obrienmd’s picture

Hrm looks like $file->new is set earlier in the function, without any option to not set it, so perhaps that's a dead end?

eugenmayer’s picture

Well it works for me yet, and iam yet not able to see how the error occurs.

in the _wysiwyg_imageupload_upload_file() method the file is uploaded in and set the $file->new. That object is later stored in the cache and loaded in wysiwyg_imageupload_form_validate() to be finally added to the node object in $form['#node']. Thats actually the object the nodeapi is later called with, so $file->new should be properly set.

Could you debug this, that means set a dsm wysiwyg_imageupload_nodeapi to node->imgupload_images and upload images. Have a look if file->new is set. If yes, after saving, have a look at your {files} table, if the file is really persistent.

Thanks for testing!

obrienmd’s picture

Everything seems to be setting fine right now (persistent)... Will see if the new post's images die tomorrow.

eugenmayer’s picture

Category: bug » support

Well seems like a lokal problem then?

obrienmd’s picture

Status: Active » Needs review

Perhaps, will keep an eye on this and report back.

eugenmayer’s picture

Status: Needs review » Postponed (maintainer needs more info)
obrienmd’s picture

Status: Postponed (maintainer needs more info) » Needs review

Hrm, OK - Blog post was just added by user with images using this module, and status in files table is "0" for all files. However, when I add a blog post, file status is "1" for all files. Perhaps a permissions issue? I'm just looking at the database now, don't have time to peer through permissions for a few hours.

eugenmayer’s picture

looking at the code, i cant yet see where it could be a permission issue - not yet

eugenmayer’s picture

Status: Needs review » Postponed (maintainer needs more info)

def. need some more informations, hope you find time

obrienmd’s picture

I haven't been able to find a thing on this, it's extremely frustrating!!!

eugenmayer’s picture

a suggestion, as iam using the file-api of drupal, are there any permissions on who is able to set files persistent?

obrienmd’s picture

Not that I can see. Another oddity - When I, as an admin, post a blog - the files are set to persistent. That leads me to the permissions theory, but it doesn't really pan out... I'm stumped. Also, when I have the user go in and "re-upload" the pics, they seem to take just fine... Odd.

obrienmd’s picture

It _must_ be something the user is doing... I just logged in as said user, posted a blog, and everything just worked great. File marked as permanent in the database (status = 1). What... the... heck...

eugenmayer’s picture

I would love to help you, but yet iam not able to get a clue here :)

tjodolv’s picture

Hello. I just installed this module for testing it, and I noticed that this happened with the first file I uploaded. Did it as user 1. Strange?

Anyway, a great module! Thanks for the good work!

pfrenssen’s picture

I can confirm the issue. I checked my database and all files that have been uploaded by admin have status=0.

When I upload new files as admin, they are not inserted in TinyMCE at all. When I upload as another user it works fine.

pfrenssen’s picture

I found the probable cause of this problem.

It was only happening with users who had the 'access devel information' permission of the devel module. I was outputting debug information to the bottom of every page (more specifically the 'Display memory usage' option) and this interferes with the working of imageupload.

eugenmayer’s picture

@ pfrenssen:you isse is different, please check #831276: Make ajax call be more robust against devel ( mem output ) and theme developer

I finally could reproduce this issue here - it happens if you use preview. It seems like cache transfering is not working here - edge case. I will fix this

eugenmayer’s picture

Category: support » bug
Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Needs work

Very critical actually

eugenmayer’s picture

Version: 6.x-2.0-rc2 » 6.x-2.0-rc4
Status: Needs work » Fixed

Well what a ugly edge case. This only happens if you preview your node and have NO validation errors. In this case the form_build_id is changed, to the rebuild flag ... holy..
http://github.com/EugenMayer/wysiwyg_imageupload/commit/73c62915e291b207...

fixed in rc5

eugenmayer’s picture

Status: Fixed » Closed (fixed)

released in rc5

obrienmd’s picture

Thanks much, I had just hacked a fix to this (set a rule to manually alter the database on node save)...