Re-Linking Images

Discuss the word processor
Post Reply
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re-Linking Images

Post by atzorman »

Hi,
I've successfully edit a book on OO Writer http://wndw.net.
This book has more than 200 linked pictures.
Now a translation of the book is expected to be released very soon.
I've got the .odt file but the translator (who is currently out of my reach) copied the book out of its original folder, on his external HD.
Obviously I cannot see the images on my document, because the path is pointing to another environment.
I would like to know if it is possible to avoid a manual re-link (EDIT>Links) of the pictures, i.e.
create a script to change the images path.
Thanks,
Paolo


Mac OSX 10.7.5
OO 4.0.0
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re-Linking Images

Post by acknak »

As long as the Writer document and the images maintain the same relative locations, the links should work automatically, even if they're all moved to a different location.
AOO4/LO5 • Linux • Fedora 23
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re: Re-Linking Images

Post by atzorman »

Thanks for prompt reply! :)
Unfortunately I'm not getting the images, I presume because path differs, as you can see from the screen shots…
Screen Shot 2014-04-27 at 14.46.08.png
Screen Shot 2014-04-27 at 14.46.50.png
Is there any alternative to re-linking manually each picture?
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re-Linking Images

Post by acknak »

You can't always tell by looking at the path that OO displays. OO always shows the full, absolute path, but that isn't what it uses internally. All linked files are maintained through a path relative to the location of the parent document.

As long as the final elements of the path are the same, OO should be able to resolve the links.

In the case of the two links you've shown, they're completely different, but I don't know if they're links to the same image or not.
AOO4/LO5 • Linux • Fedora 23
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re: Re-Linking Images

Post by atzorman »

acknak wrote:You can't always tell by looking at the path that OO displays.
:?
OO always shows the full, absolute path, but that isn't what it uses internally. All linked files are maintained through a path relative to the location of the parent document.
Is there a way to check the relative path?

As long as the final elements of the path are the same, OO should be able to resolve the links.
In the case of the two links you've shown, they're completely different, but I don't know if they're links to the same image or not.
One path has been truncated by the snapshot, but actually both are links to the same image. Images are in the same text file folder, but still the are not loaded...
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re-Linking Images

Post by acknak »

There's no way (that I know of to check the relative path, other than to look at the trailing element(s) of the path.

I just tested again with a linked image in a Writer document: it works perfectly as long as the two files are in the same relative locations.

The simplest arrangement is to put all the images for a document in the same folder/directory/location as the document. If there are many such images, then you may want to collect them all in a folder in the same location. Then, if you move the image files (or the image folder with the images) along with the document to some other computer or location, the links should still work.

I do notice that your example includes a "funny" character: #, shown as %23 in the path.

I wonder if that could cause a problem? It doesn't seem to here, but other systems/situations may give different results.

It might be helpful if you could copy/paste the full text from one or two of your linked images. Right-click on the image > Picture > Picture should display the entire path which you can copy/paste here. Do that for the document in the original situation and for the document after it's moved and paste the alternative paths here so we can see what you're dealing with.
AOO4/LO5 • Linux • Fedora 23
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re: Re-Linking Images

Post by atzorman »

Here:

original
file:///Users/atzorman/Desktop/WNDW/WNDW_master/WNDW_master/cc-by-sa.png
Screen Shot 2014-04-29 at 17.17.04.png
translation
file:///Users/atzorman/Desktop/Volumes/NO NAME/WNDW_Master%231.421/cc-by-sa.png
Screen Shot 2014-04-29 at 17.16.07.png
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re-Linking Images

Post by acknak »

Right. So it looks like the document and the image are not in the same relative locations.

What is the location of the original document? Is it in the same folder as the images?

If your goal is to make a new copy of the document in a different location and have it share the same images, then you're going to be limited in where you can put the new copy and still maintain the relative locations. You may need to copy both the document and all the images to the new location.
 Edit: PS: 
Here's an example from the document I tested:
relative_link.png
As long as OO Writer can locate the image following the steps:
  • (document location) / up one / up one / folder:images / file:CCG_logo.png
then the image will be displayed.
AOO4/LO5 • Linux • Fedora 23
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re: Re-Linking Images

Post by atzorman »

acknak wrote:Right. So it looks like the document and the image are not in the same relative locations.

What is the location of the original document? Is it in the same folder as the images?
Yes. And if I move/copy the folder where I have picture and .odt file it always works. I can open the file on different computer without any problem.
In this case I sent a copy of the folder to the translator who opened the file loading all images without any problem.
But during his work he moved the folder to an external HD and save there the .odt file of the translation.
I got the whole folder with the translation back from him, but in no way pictures are loaded because as you recon relative paths are not the same.
I'd like to know if it is there any alternative to manually re-link each of the 200 images…

…& thanks for the very clear directory scheme you attached :) !
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
RoryOF
Moderator
Posts: 35203
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Re-Linking Images

Post by RoryOF »

You could open the file using an archive manager, then globally find and replace the paths in question. They should be in content.xml. If doing this please use a copy of the file in case of disaster.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
atzorman
Posts: 10
Joined: Wed Apr 03, 2013 12:45 pm

Re: Re-Linking Images

Post by atzorman »

RoryOF wrote:You could open the file using an archive manager, then globally find and replace the paths in question. They should be in content.xml. If doing this please use a copy of the file in case of disaster.
Thanks, it sounds like the solution :)
Could you please tell me where I can find the content.xml of my .odt file?
OpenOffice 3.4.1
Mac OS X 10.7.5
User avatar
RoryOF
Moderator
Posts: 35203
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Re-Linking Images

Post by RoryOF »

Open the .odt file using an archive manager - depending on the manager you may need to rename it to .zip. In the opened archive you should find content.xml. But please, please make a copy of the .odt file first, as editing contents of such archives can be dangerous. With a copy of the .odt you have a secure fall-back position.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Re-Linking Images

Post by acknak »

I agree: editing the xml is the only way I know of to fix the broken links, short of manually changing each image.

If you want some help, let me know. It won't take five minutes and I'd be happy to help. PM me, or use the email link to the right of this message.
AOO4/LO5 • Linux • Fedora 23
Post Reply