Please help. I managed to convert my D 5.3 site to 5.7, but all the images can't be seen. Guess the paths are different. I have backed up everything and need guidance on how to fix this.

Since this is a test site, the 5.3 image path is http://localhost/drupal-5.3/drupal-5.3/files/images while the 5.7 path is http://localhost/drupal-5.7/files/images

Is there any way to globally change these paths? There are hundreds of images!!!

Thanks in advance for your help.

Comments

dshaw’s picture

It seems you've used 'drupal-5.3' in your actual file path to images. If so, this is A Bad Thing(tm). As you've discovered, when you upgrade, your path no longer works. You should aim for a non-version specific file path, eg. http://example.com/files/images. You should also aim to use just the path elements of the URL, ie. /files/images. Then when you move domains you don't run into the same sort of problem.

A couple of possible solutions to your problem spring to mind:

1) Create a symbolic link in the directory that corresponds to drupal-5.7, to drupal-5.3. This will effectively re-create the path. This is quick and nasty, as it leaves you with poor paths. And you'll need to re-create the link each time you upgrade.

2) Better, but more complex, would be to run an SQL script against your database to update the paths. This is a long-term solution, ie. you only need to do it once. I'm not enough of an SQL expert to do it in one step. But if you did a SELECT statement on the files table on the fid and filepath columns you'll get a list of all your fid, filepath pairs. Then convert that to an SQL script to do an SQL update per path that needs fixing, eg. set filepath = <path without drupal-5.3> where fid = N;. You can script or otherwise automate the generation of this script.

(I'm sure there's a nicer way to do (2). Perhaps an SQL guru will chime in.)

Thomasr976’s picture

DSW, I looked at the MYSQL file tables and all of the images are have relative paths, i.e. set to files/images/something.jpg.

However, when I look at the specific node (article) where the image is supposed to render, the path is absolute http://localhost/drupal-5.3/drupal5-3/files/images/something.jpg

Since I added images using IMCE and Tinymce, I'm thinking that the error might be there. Any insights would be appreciated. Thanks.

Mark Theunissen’s picture

Wait! Before you hack apart everything, how are you displaying images? Are you really hard-coding the image paths in your node content, or are you using the img_assist module with the image module?

If you're using the modules, then the problem will be solved by clearing the cache... use the devel module for that!

Hope that helps!

Cheers
Mark

Code Baboon
Drupal based services

Thomasr976’s picture

Thanks DShaw and Mark for your very prompt responses.

As I mentioned, I've used the above modules to insert images. Since I am running drupal on XAMPP on my laptop, I thought that it would automatically take care of this, but apparently it has not. Mark. will clearing the cache still work? Also I am worried that when I migrate to my webhost's server I will experience the same thing.

Also saw an issue about relative paths at http://drupal.org/node/199484#comment-655195. have to confess that I don't really understand this. Perhaps you do and can help.

I know when I worked with Mickeysoft's Frontpage, it would recalculate paths and resolve this problem. I wondered it the path redirect module would take care of this.

I appreciate any further ideas.
Tom

Thomasr976’s picture

It has been one of these days. I'm going nuts here.

Decided to install devel mod just to clear cache and see if I can see my images. Can't see anything that resembles a "clear cache" setting. So what i am obviously overlooking?

Is this not showing up because I used IMCE mod and tinymce to upload images in the first place. umm?

dshaw’s picture

I can't recall off hand where you find the cache clear link.

However I'm pretty sure it's at: http://example.com/devel/cache/clear

Or possibly: http://example.com/admin/devel/cache/clear

So you should be able to type the corresponding URL into your browser. You'll get a "cache cleared" message if it works.

Thomasr976’s picture

the images still can't be seen. Dshaw, if I was starting from scratch and developing on a test site in xampp, how would I set the image path to get what you mentioned in your first post?

I read numerous posts and it seems like one should be able to set this in tinymce, but that's probably applicable to future posting of nodes with images in them.

I am probably going to try what you first suggested since the Devel mod didn't resolve the situation. Thanks for your help. i'll let u know how it goes.

xjessie007’s picture

Does anyone know which link leads to the devel/cache/clear page? I installed the Devel module yesterday in an effort to use this clean way of clearing cache, but I can't find the link or a button that really leads to the cache clearing. I can however confirm the devel/cache/clear page does work, it does clear out some of the cache tables.

Btw, this is a nice page that talks about how to delete Drupal cache tables.
How to properly 'clear' the accesslog, cache, and watchdog tables in my database? (http://drupal.org/node/17620)

www.Maxi-Pedia.com

dshaw’s picture

I couldn't find a link to it either. I think I read about it somewhere and remember it because it's useful. Or possibly, the version for D6 has a link.

Thomasr976’s picture

Since I had made backups of my previous drupal version and SQL, I redid the upgrade from 5.3 to 5.7. Same bloody problem. However, this time I compared my folders in both 5.3 and 5.7 and found that my files folder was in the wrong place. Nevertheless the comments here and elsewhere in the forums helped me think through this and get more familiar with the MYSQL db and relative and absolute paths.

Now the challenge is to FTP everything from the test site to my WebHost. I still may have to pay the ultimate price but time will tell. Thanks to all.

kwixson’s picture

The user who posted the original problem has solved his issue, but his/her problem is still a problem for a lot of people under the following circumstances:

+ In a multisite environment where the site is moved from one domain to another, such as when creating a test/devlopment site at demo.domain.com and you move it to the 'default' site. The path in the MYSQL table will be /sites/demo.domain.com/files/image/ but the images will be in /sites/default/files/image after the move.

So, I think we still need to figure out how to move images.