I've noticed that after uploading option images, the images disappear after a while. The most recent examples were uploaded on Friday afternoon and were gone by Monday morning without anyone working on the site.

I checked the uc_option_image table and the entries are still in there. However looking for the FID numbers for the missing images in the file_managed table reveals that those files are missing from the table. Interestingly, it only happened on 2 out of the 3 test images I uploaded on Friday afternoon.

I noticed a similar issue in an old thread here - http://drupal.org/node/479312

I'm using Drupal 7.15 and Ubercart 7.3.2. If someone could offer some fairly urgent help on this that would be great as I have a client waiting to upload their products. Thank you.

Comments

Anonymous’s picture

Anyone... help!

jawi’s picture

In our case the images didn't disapear, but lay on top of each other.
Also css is very inportant when u use multiple attributes.
When changing the postition of the selected image, you should also look at the javascript and adjust things to your needs.

Hope this helps

Anonymous’s picture

There doesn't seem to be a maintainer for this module, so I've investigated this problem myself. The problem was that the file status of uploaded files was being set to 0 which denotes a temporary file. Thus when garbage collection happened (the first cron run 6 hours after the upload) the files were being deleted.

Looking at the uc_option_image.module file I found that the condition on line 376 wasn't being fired. So the $file->status wasn't being set to 1.

I worked around this problem by removing the 'else' and 'if' conditions around the following lines:

$file = file_load($values['fid']);
if ($file) {
  $file->status = 1;
  file_save($file);
  file_usage_add($file, 'uc_option_image', $type, $object->$id_key);
}

So these lines appear directly above $object->fid = $values['fid'];

I haven't completely tested this, but it does set the file status correctly so I think it's the solution I need.

liberatr’s picture

Assigned: Unassigned » liberatr
Issue summary: View changes
Status: Active » Fixed

This is in the beta release, marking fixed.

Status: Fixed » Closed (fixed)

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