Wrong path to images after upgrade from 5.x to 6.x

GoofyX - August 24, 2008 - 20:05
Project:Image
Version:6.x-1.x-dev
Component:image.module
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

halftone - August 28, 2008 - 11:45

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

GoofyX - August 28, 2008 - 15:48

Thanks for the link, it's useful. If you see my initial message, I say:

I did so and I also changed the filepath field in the files database table to point to the new path.

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

halftone - August 28, 2008 - 17:57

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

GoofyX - August 28, 2008 - 18:13

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 is files/. Under 5.x, images (for the image module) are stored in files/images. So far good. What I did was:

1) Move files/ under sites/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.jpg to the new sites/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

halftone - August 28, 2008 - 23:12

"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

GoofyX - August 29, 2008 - 04:37

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

GoofyX - August 29, 2008 - 15:23

Clearing the cache did not help...

#8

GoofyX - September 1, 2008 - 20:16

Any clues of where to look inside the module to debug this issue... ?

#9

GoofyX - October 20, 2008 - 20:33

Is there any progress with this bug...?

#10

GoofyX - October 21, 2008 - 20:37
Status:active» closed

A lot of hours would have been saved if there was somewhere some kind of a notice that would say

If you have image-5.x-1.x installed, then before upgrading to Drupal 6, you must first upgrade the module to 5.x-2.x and then upgrade to 6.x.

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

halftone - November 2, 2008 - 13:37

Ouch! Thanks for the explanation and warning.

 
 

Drupal is a registered trademark of Dries Buytaert.