Hi

some time ago I migrated from host, distro, php version and drupal version so I was bound to have some problems. I have tackled them all but one, the image module doesnt show my images.

Some info (i can post more, but please ask what you need!)
site:
http://willy.boerland.com/myblog/image

example:

database:
nid, url 2864 images/img_a0124389a1d8bbb680676bd1c1fa5fc3.jpg
os:
[root@tug myblog]# ls -al images/img_a0124389a1d8bbb680676bd1c1fa5fc3.jpg
-rwxr-xr-x 1 apache apache 15081 Sep 16 14:16 images/img_a0124389a1d8bbb680676bd1c1fa5fc3.jpg
source code:
url:
http://willy.boerland.com/myblog/node/2864

empty page, no image

source code:
img src="http://willy.boerland.com/myblog/images/s//img_a0124389a1d8bbb680676bd1c..."

note the trailing _0 in filename and the extra dir /s/

is there anyway to remvove the faulty path or other options I can do? Any help appriciated. When this is solved, I'll buy everyone a drink at the upcomming drupalCON!

Comments

walkah’s picture

the _0 is generated by file.inc when a collision is detected (to prevent from wiping existing files) ... and shouldn't be a problem.

the /s/ is more disturbing...

James Walker :: Bryght Guy

--
James Walker :: http://walkah.net/

bertboerland’s picture

since the underscore file doesnt excist? could i do a dump of the database and just use sed to delete it?

--
groets
bertb

--
groets
bert boerland

bertboerland’s picture

imagfe table shows:

nid, path
2864  	images/img_a0124389a1d8bbb680676bd1c1fa5fc3.jpg

so thats correct!

But in the source of that nid you will find:
myblog/images<b>/s//</b>img_a0124389a1d8bbb680676bd1c1fa5fc3<b>_0</b>.jpg

where does the /s/ come from?
--
groets
bertb

--
groets
bert boerland

donkilo’s picture

I am getting the same problem with my website:

http://redriecken.haciendadelpueblo.com/?q=node/9

It's adding the extra _0 even though that file never existed before. What can I do?

chx’s picture

$files = file_scan_directory('files/images', '.*', array('.', '..', 'CVS'), 0, TRUE, 'filepath');
$result = db_query('SELECT * FROM {files}');
while ($file = db_fetch_object($result)) {
  if (strpos($file->filepath, '_0.')) {
    $file->filepath = str_replace('//', '/', $file->filepath);
    $file->filepath = str_replace('_0.', '.', $file->filepath);
    if (isset($files["files$file->filepath"])) {
      db_query("UPDATE {files} SET filepath = %s WHERE fid = %d", $file->filepath, $file->fid);
      echo $file->filepath;
    }
  }
}

fixes. Note that the script is somewhat safe, it only updates DB if the result is an existing file. It _is_ possible that there still will be a problem, dump the DB first.

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.