Jump to content

After migration, images are not displayed, destinationPath is not writable


Guy Verville
 Share

Recommended Posts

It is probably something quite easy to solve, but I can't figure where. I have begun a simple site. Each page has some screen captures inserted in the body field.

On my local machine, everything is fine (http://localhost).

I uploaded the entire site, migrated the database, the site resides under a two levels deep directory: http://adomain.com/sites/manuel

Every image has an alleged broken link, the source reads like this <img src="/site/assets/files/1011/goog....

post-1691-0-84626700-1379508967_thumb.pn

The images field is correct, in edit mode, but still no correct display.

post-1691-0-51078800-1379509044_thumb.pn

Editing the image show it correctly!

post-1691-0-09983500-1379509115_thumb.pn

Saving gives this error:

post-1691-0-95375700-1379509148_thumb.pn

But the page now looks perfect because the linked has been correctly written:

<img src="/sites/manuel/site/assets/files/1011/goog....

I have tried rewriting the base in htaccess in this fashion, but to no avail.

RewriteBase /sites/manuel/

The root site is made with Drupal. This minisite, inside the directories, is for a technical manual.

How do I solve this?

Thank you in advance.

Link to comment
Share on other sites

The simplest way to make the images added in textarea field show after migration is to preserve the same folder structure and folder names as it was on the previous machine.

For example if your image was originally stored in let's say: localhost/project-name/site/assets/files/... don't change that to for example: localhost/changed-project-name/site/assets/files/... Just keep the original folder naming and structure and it should work. On live server you should use the same methodology as with localhosts.

If you can't do it for some reasons maybe you should edit htaccess file and try to rewrite the old URL of the folder containing your images to the new, like:

RewriteRule ^/olddirectory(.*) /new-directory$1 [R=permanent,L]

I didn't check the second way so I'm not sure if it works.

All this fuss with images not showing is because the URL of images added in textarea field are stored as they are and when you change the structure or names of the folders the URL is no more valid. The Firebug will show you error 500 (which is unfortunate) but when you change the DocumentRoot in Apache config to folder where you keep the website files the error will be 404 - which means that the image wasn't found due to wrong URL.

I hope I made myself understandable :)

  • Like 1
Link to comment
Share on other sites

Hello Mike,

Thank you for your answer. I would have thought that the path remained relative to the root of the Processwire folder... Since I am in the beginning of the development, I will change the structure of the local site. This is a disadvantage, i think. Anyway, thank again.

Link to comment
Share on other sites

Guy - try this: http://processwire.com/talk/topic/236-module-page-link-abstractor/ You may have to re-save your pages though (I'm genuienly not sure).

On another note, is there any particular reason the site is under a subdirectory?

You could also try this anywhere in your <head> tag in the head.inc file, but this may present other potential issues in your templates (just so you're aware):

<base href='http://yourdomain.com/subdirectory'>
Link to comment
Share on other sites

Hello, thank you for your suggestion. Yes, there is a reason. The project is for a technical manual. Since the root site is a Drupal one, I prefer to put it in the subdirectory devoted to data (/sites/) This subdirectory possesses already other subdirectories. The manual is then just another one.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...