CCK 5.x.1.5
imagefield 5.x.1.1
TMP & Files folder permissions: 777 recursive
Download Method: Public

Imagefield Configuration:
Max resolution 0
Image path: product/logo
Enable custom alternate text: off
Enable custom title text: off
Required: off
Multiple values: off

OK,

So I've been using this module for a while now on my production site, and users are uploading images to this and many other imagefields. The problem is that sometimes (seemingly at random) the files disappear from the server but a db entry remains in the files table, causing lots of broken links for the user and obvious frustration.

I'm sure there must be a pattern, but I haven't found it yet -- and I am hoping to save myself some time finding it by asking around to see if anyone else has encountered a similar problem.

BTW, I am also using Imagecache (5.x.1.3). Could it have something to do with it? I really don't see how it could, but thought I would include that anyway.

Thanks,
Owen

Comments

oprior’s picture

I'm still having this issue.

Is there anyone monitoring this area????? I tried to be as descriptive as possible!

vertikal.dk’s picture

Oprior,

If it's any comfort, I have the exact same problem, and have had it before, but never found an explanation. Much the same setup as you - I use Image Assist - but pictures on the site I'm working on, just randomly disappear. I can go through the dialog of entering them through TinyMCE and just click Insert with no changes, and sometimes it helps. But just briefly. Most of the pics will vanish again.

The strange thing is that the files are still on the server untouched, and the images are still registered as nodes in the system. They just don't get rendered.

I'm working on a solution and will post it if I find one.

- Martin

oprior’s picture

Thanks Martin,

It's a relief to know I'm not the only one!

vertikal.dk’s picture

Oprior,

Although my problem was not with imagefield but with Image Assist, the reason and solution I found may help you and others.

My problem was caused by moving the site from a development server to a live server with a different domain name. Obviously the system had stored the absolute paths/url's to the images somewhere deep inside, and kept referring to the original location even though the site had moved. Editing the nodes that used the images would sometimes help, editing the image nodes themselves would sometimes help. In most cases nothing would help.

I found out by doing a right click and a View Image on a missing picture, and noticed that Drupal was trying to fetch it from a no longer existing development server.

I did a couple of things:

1) alias the original development domain to the new live one (Unix and Apache magic!). That enabled the live site to find the development server. A temporary solution since I want the development server to die.

2) clear all cache tables in the database. Drupal seems to keep some elements cached even though I have no cache turned on in the system. Most of these contain binary fields, so I couldn't check whether this was the reason for the malice or not.

I have checked today, and all images now seem to be fetched from the live server, and it seems that Drupal will itself make the transition in the course of time when caches expire or whatever.

This did it for me, and the site is now running nicely.

Martin

sun’s picture

@vertikal.dk: The Image Assist issue you mention has been fixed in the past days. Please download the latest development snapshot of Image Assist and report back in in this issue if you further encounter this bug.

@oprior: Are all images affected? Is it possible that this bug may be related to non-ascii characters in filenames? You might try Transliterate filenames module.

oprior’s picture

No, sample filename = birch_mas_137.jpg

In one case, a user reported seeing the images, did a browser refresh and then they all dissapeared.

oprior’s picture

I was just checking my logs and noticed a series of 6 php errors resulting from one page:

Type	php
Date	Wednesday, October 24, 2007 - 20:39
User	Anonymous
Location	http://www.qualitycraft.com/files/imagecache/Product_Listing/
Referrer	http://www.qualitycraft.com/node/692
Message	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(node.nid) FROM node node LEFT JOIN node_data_field_action_links node_da' at line 1 query: SELECT node_data_field_action_links.field_action_links_nid AS DISTINCT(node.nid) FROM node node LEFT JOIN node_data_field_action_links node_data_field_action_links ON node.vid = node_data_field_action_links.vid INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'workflow_access') OR (na.gid = 0 AND na.realm = 'workflow_access_owner') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 0 AND na.realm = 'tac_lite') OR (na.gid = 0 AND na.realm = 'tac_lite'))) AND ( node.nid = 105 ) ORDER BY node_data_field_action_l in /home/marketing/drupal/includes/database.mysql.inc on line 172.
Severity	error
Hostname	24.76.178.34

I have been having this error for a while, attributing it to tac_lite, but noticed that the location of the php error was an imagecache path to an imagefield. Could a certain max number of these errors cause drupal to erase the files?

sun’s picture

Category: support » bug

It's caused by this:

WHERE (na.grant_view >= 1

which would turn this issue into a Node Access module bug. If both of you are using Node Access, please move this issue to the Node Access issue queue.

dopry’s picture

Project: ImageField » Nodeaccess
Version: 5.x-1.1 » 5.x-1.x-dev
mantyla’s picture

Project: Nodeaccess » ImageField
Version: 5.x-1.x-dev » 5.x-1.1

@sun: That was just ">" getting replaced with the html code during copy and paste. Secondly, the node_access table is part of Drupal core, and not related to the Nodeaccess module in any way.

And the actual syntax error in the query was the "DISTINCT" part, just like the error message said:

SELECT node_data_field_action_links.field_action_links_nid AS DISTINCT(node.nid) ...

This is just plain wrong. It looks like the author was trying to fetch one row for each distinct node, which is possible to do in PostgreSQL, but not in MySQL, so trying to do that in a Drupal module was wrong from the start - and the author didn't even get it right. What he was probably trying to do is this:

SELECT DISTINCT ON (node.nid) node_data_field_action_links.field_action_links_nid ...

The above would work in PostgreSQL but not in MySQL. I really have no idea what the author was trying to accomplish, so I don't know how the query should have been written.

Bottom line: the sql code in that error reeks of inexperience. I don't know which module it came from, but I would recommend that you get rid of it, fast. I can tell you it's not from Nodeaccess or ImageField.

While the sql error probably has nothing to do with ImageField, the original problem remains, unless it has been fixed during the last months.

quicksketch’s picture

Status: Active » Closed (fixed)

I can't really follow this issue, but the version of ImageField affected is ancient. If this problem still occurs on the latest releases of ImageField, please reopen.

kris digital’s picture

Version: 5.x-1.1 » 5.x-2.6

I still have the problem that images are deleted from the Server. I think it is a problem with i18n... if the content is duplicated the link to the images stay the same. If then one of the translations gets deleted, the image disappears for the others. I thought I fixed it once, but it's happening again...

update: I fixed it by checking, if the image is used by anyone first. If anyone needs it:


function _imagefield_file_delete($file, $fieldname) {
  if (is_numeric($file['fid'])) {
    db_query('DELETE FROM {files} WHERE fid = %d', $file['fid']);
  }
  else {
    unset($_SESSION['imagefield'][$fieldname][$file['sessionid']]);
  }

//hack for i18n
  $needed = db_query('SELECT count(*) FROM {files} WHERE filepath="%s"', $file['filepath']);
	
  module_invoke_all('imagefield_file', 'delete', $file);
  if(db_result($needed) == 0) return file_delete($file['filepath']);
  else return true;
}

KaoszNagymester’s picture

Version: 5.x-2.6 » 6.x-3.9
Status: Closed (fixed) » Active

I still have this problem. Which file did you write this code?

quicksketch’s picture

Version: 6.x-3.9 » 5.x-2.6
Status: Active » Closed (fixed)

Please do not re-open ancient (D5) issues.