Wrong path to images after upgrade from 5.x to 6.x
| Project: | Image |
| Version: | 6.x-1.x-dev |
| Component: | image.module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I have a 5.10 site with image 1.9 installed. I have a few images and they are installed under files (the default directory in the file system settings). I upgraded the site to 6.4 and image module to version 6.x-1.0-alpha3. The images show up fine. Then I thought I should move the files/ directory under sites/default where a default 6.x installation puts it. I did so and I also changed the filepath field in the files database table to point to the new path. However, images do not show up now and they instead point to sites/default/files/files/images/<image filename>. It appears that an extra files string appears. However, for new images, it works fine.
All other site attachments work fine under the new path (and after changing the filepath db field). I also tried the latest dev version and still no luck. If I revert back to the files/ setting, the images show up fine.

#1
You'll have to change the filepath for existing images, in the files table (assuming 6 handles this the same as previous versions of Drupal). See http://drupal.org/node/184489#comment-729048 for the SQL for resolving this with a 4.7->5 upgrade, and adapt to your old & new paths.
#2
Thanks for the link, it's useful. If you see my initial message, I say:
So, I already did what you proposed (all attachments in the files db table now point to
sites/default/files/<attachment name>). Unless there's another place in the database that Drupal writes the path to a file (image in my case), then I am forced to believe that this is an issue with the image module, since all other non image attachments work under the new path.#3
Sorry, I can't read properly after a week of lost sleep over similar image issues after 4.7->5.10 upgrade.
I have a suspicion your filesystem path should now be 'sites/default/files' under Drupal 6,(not 'files') and image path 'images', and your filepaths in the DB simply 'files/images/example.jpg' (or maybe even 'images/example.jpg', like 4.7 was). Drupal (from 5.something) seems to do fancy stuff behind the scenes (the Realpath() stuff I mentioned in the thread I referenced) which deduces and tests the absolute server paths for URL's of attached files/images, and it's quite possible to create filepaths which work unpredictably depending on variables stored GOK where, or wind direction, or something.
Trial and error was the only way I was able to figure out what I was supposed to do. then the documentation finally made sense ;-) I'd try those paths and changing the filepath of just one image in the table, and see if it works or not.
At least that's my uneducated guess. But I feel like I'm a chimp trying to reverse-engineer a nuclear reactor with a rock... Hopefully someone who actually knows what they're talking about might be able to advise.
#4
Ok, here I go again.
The default filesystem setting for Drupal 6 is indeed
sites/default/files/. After upgrading a 5.x installation to 6.x, the filesystem setting remains to the 5.x default, which isfiles/. Under 5.x, images (for the image module) are stored infiles/images. So far good. What I did was:1) Move
files/undersites/default/.2) Change the filepath field inside the file db table to point to the new path for all attachments. So, an image file points from the old
files/images/foo.jpgto the newsites/default/files/images/foo.jpg.I hope that's clear. After doing these two steps, the images are not displayed. However, new images submitted are indeed displayed. So, the problem is for images transfered from the old path to the new one.
This issue is maybe the most important that prevents me from upgrading the site to 6.x.
#5
"The default filesystem setting for Drupal 6 is indeed sites/default/files/. After upgrading a 5.x installation to 6.x, the filesystem setting remains to the 5.x default, which is files/."
May be just a typo but in case not, neither of these settings should have trailing (or leading) slashes, I believe.
I assume you've emptied all the cache tables?
#6
Yeah, my mistake. I added the trailing / for clarity (to imply it's a directory), of course in Drupal it's set to
sites/default/files.I haven't tried emptying the cache. This is what I'll do next. Thanks for the suggestion.
#7
Clearing the cache did not help...
#8
Any clues of where to look inside the module to debug this issue... ?
#9
Is there any progress with this bug...?
#10
A lot of hours would have been saved if there was somewhere some kind of a notice that would say
That's the way I solved my problems. Because upgrading straight from 5.x-1.x to 6.x-1.x, running update.php fails with database errors. I'm marking the issue closed for me.
#11
Ouch! Thanks for the explanation and warning.