[Solved] Smart way to change links to images ?

Discuss the presentation application
Post Reply
kevegas
Posts: 2
Joined: Wed Jun 11, 2008 9:14 pm

[Solved] Smart way to change links to images ?

Post by kevegas »

IS THERE a smart way to mass-change all the links to all my images in my presentation?

I've tried to move a presentation to a flash-drive, then discovered all images were linked and not actually embedded. I must change
the links for 80+ images. There surely must be a smarter way to do this.

Any help would be greatly appreciated!
Last edited by Hagar Delest on Fri Jun 20, 2008 11:40 am, edited 1 time in total.
Reason: tagged the thread as Solved.
OOo 2.3.X on Ms Windows XP
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: smart way to change links to images ?

Post by RGB »

Edit -> links -> break link (you must select them first)
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: smart way to change links to images ?

Post by Villeroy »

As far as I know from Writer with linked pictures, all paths are relative (./subdir/picture1.png) even if they are shown as absolute paths (file:///path/subdir/picture1.png). So when I move file:///path/document.odt together with ./subdir/, the linked picture will be located in file:///new_path/subdir/picture1.png
Give a try.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Phil
Volunteer
Posts: 802
Joined: Fri Nov 30, 2007 5:35 pm
Location: Germany

Re: smart way to change links to images ?

Post by Phil »

Villeroy is indeed right, so I hope this solves your problem.

If not, you may try the following:
Rename the .odp file to .zip and open it as ZIP archive using some archiver tool like 7-Zip (in fact all the OpenOffice files are ZIP files with various files that contain the document structure, images etc.).

Now extract the file content.xml from the ZIP archive and open it using some text editor (ideally one that does syntax highlighting, e.g. Notepad++).

For each link, you will find an entry like this in the file:

Code: Select all

<draw:image xlink:href="../Image.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad">
Now you can change the paths of all images using Find & Replace.
Finally, update content.xml in the ZIP archive with the changed version and rename the file back to .odp.

I admit it's not a straightforward way, but it works. :mrgreen:

BR, phil
OOo 3.0.1 & DEV-3.1 • WinXP pro 32-bit + SP3 + current patches
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
micha137
Posts: 33
Joined: Mon Dec 03, 2007 12:25 pm
Location: Wedel/Germany

Re: smart way to change links to images ?

Post by micha137 »

Hi there,
I frequently had the same problem when porting presentations between machines with different directory structures, when accidentally absolute paths were introduced.
For me directly editing the content.xml file seemed the best option.
You don't have to rename the files to *.zip. You can explicitly open them with any archiver.(In ubuntu e.g. I just select "Open With" "XArchiver"),
edit the files(e.g. with "mousepad" in ubuntu), correct the paths per find and replace and put content.xml back into the archive.

I would not recommend breaking the links since this will greatly increase filesize. You won't be able to undo this without a lot of work and are stuck with the big files. I prefer keeping backups after editing my presentations on a regular basis and with embedded media this would mean storing masses of redundant data.
Breaking the links might be ok if you are just dealing with very few presentations containing small media files, but in my opinion it is not an elegant solution.

In fact I miss a function in impress to outsource media files to a specified directory.

regards
micha137
OOo 3.0.X on Ubuntu 8.x
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: smart way to change links to images ?

Post by acknak »

I would not recommend breaking the links since this will greatly increase filesize. You won't be able to undo this without a lot of work and are stuck with the big files.
You have a good point, but I don't understand how it would make that a big a difference. How big does a file have to be before it's a problem? I remember when a 1M image was "too big". Now, a 50M file is really not a problem. A 50M presentation file can hold a lot of images.

Also, if you have the images linked in, the presentation is no use without the images so you have just as much file storage to move around, but now you have to worry about moving several (or many) files, and keeping the correct relative locations (or editing the links).

I think my presentation file would have to be >>50Mb before it would be worth all that hassle. At 700-1000k of image per slide, that's still over 50 slides.

Further, many people do not understand the effect of image resolution in a presentation. There is no advantage to include images that exceed 1000 pixels across, but people still just copy and paste their camera images that are 2-3 times more (5-10 times the file size) into their presentations, resulting in a 100 megabyte presentation that has only 20 slides.

One handy tool that can help in that case is the Sun Presentation Minimizer. It will analyze a presentation and scale the images to minimize the file size without sacrificing image quality.
AOO4/LO5 • Linux • Fedora 23
kevegas
Posts: 2
Joined: Wed Jun 11, 2008 9:14 pm

Re: smart way to change links to images ?

Post by kevegas »

THANK YOU, one and all. I had the most luck with Phil's suggestion and the work was pretty quick. Good tip also on the size-of-images as I can now reduce the overall file size. My first post to this forum -- GREAT and timely responses. THX ! - kevegas
OOo 2.3.X on Ms Windows XP
Post Reply