Missing Images after changing "document root dir"

Previous topic - Next topic

scriber

Let's say we have a "root directory", a folder in which we store all documents images and text files that will become part of a final magazine.
This root folder contains also a subdir called "layout" in which I put my ".sla" file to work on with Scribus.
In my "workflow" I have many root dirs, one for each issue of the magazine, for example:

2022-february
2021-november
2021-august
and so on...

I use to maintain also a symbolic link to the current issue I'm working to, called "current-issue".
When a issue is complete and released for printing, I create a new directory for the next one, named let's say 2022-may, and edit its symbolic link:

current-issue -> 2022-february/

mkdir 2022-may
rm current-issue
ln -s 2022-may current-issue

current-issue -> 2022-may/


What's happen to my .sla file in the old root?
Seems links to images contained doesn't point to the right files. For instance If I open:

2022-february/layout/2022-february.sla

Images frames are empty and report an error like "image.jpg not found".
If I remove the new link current-issues and re-create it pointed to the old 2022-february, images re-appear again.

May be Scribus file contains info about images with their absolute path?


utnik

hi scriber

Quote from: scriber on February 21, 2022, 02:18:10 PM...May be Scribus file contains info about images with their absolute path?

it shouldn't – and mine doesn't!
you may check the path by opening an .sla file in a text editor and search for one of the images...

utnik

scriber

Opening as suggest I noticed all images are included with a "link" as follow:

PFILE="../../current-issue/IMG/example.png"

root structure is something like:
current-issue
├── IMG
│    └── example.png -> ../example/example.png
├── LAYOUT
│      └── 2021-november.sla
└── example
      └── example.png


Image example.png is in subdir "example" (this would be a directory containing all documents and images related to "example" article).
Actually I link all images of the whole magazine in an other subdir caller "IMG", this step is done by a script that finds all images and for each of them creates a symbolic link in dir "current-issue/IMG".
In that way I can load images from Scribus picking from the same directory "IMG".

The problem could be "PFILE=" parameter set to ../../current-issue/IMG/example.sla
This path is actually "relative" to LAYOUT subdir, the one in which .sla file is saved, but current-issue is not a directory, is a symbolic link to a directory, so when it will be pointed to an other dir, that image will not be found anymore.

Shouldn't PFILE point to ../IMG/example.sla ?
That would be actually relative to the path of .sla file. And wouldn't matter how the parent directory is named (current-issue rather than 2021-november).

Is there a way to obtain this?
Otherwise I'll revise my choice to use the symbolic link "current-issue".

scriber

Really strange...
I tried to create a testing folder:
scribus-test-image$ tree
.
├── IMG
│   └── images.png -> ../SRC/images.png
├── LAYOUT
│   └── LAYOUT.sla
└── SRC
    └── images.png

3 directories, 3 files

In LAYOUT.sla, I loaded the symbolic link IMG/images.png to the real image file SRC/images.png.
In sla file there is:

PFILE="../IMG/images.png"

As expected... So really strange the PFILE(s) path in old sla files, in which I read something like PFILE=../../parent-dir/IMG/imagefile.jpg.

Maybe it was caused by the previous versions of Scribus?
Now I'm with 1.5.8 version (thanks to flatpak).
Previous documents have been made using 1.5.7 and 1.5.5 scribus versions.
Why in those old documents I have that strange path related to images in PFILE variables? (../../parent/IMG, and not just "../IMG")

scriber

I'll try to share my little test and give an answer by myself to my own question.

Referring to my last post tried to create a new symbolic link to "scribus-test-image" folder.
Then I tried to open ".sla" file from within Scribus.

ln -s scribus-test-image linkto-scribus-test-image
cd link-to-scribus-test-image/LAYOUT
scribus LAYOUT.sla

From scribus I re-loaded the image "../IMG/images.png".
Save .sla file.
Then check PFILE var contained in it with "less" pager.. and SURPRISE!

PFILE="../../linkto-scribus-test-image/IMG/images.png"

So, the rule seems to be as follows:
- if SLA file is placed within a symbolic link to a folder (for whatever reason), when you load images placed in that same "symbolic link directory", then scribus will refer to them by adding the name of parent directory:

"../../symbolic-link/IMAGE_SUBDIR/image.whatever"

Hey folks,
I don't know what you think about it, but in my view It is a bug, or something really similar to a bug.
If the parent directory (or "root dir" as I called it in previous messages) is a symbolic link to a folder rather than it is a real folder, scribus shouldn't care about it.
Don't you agree?

I'll try also a simpler test to confirm this strange behavior.

scriber

I can confirm my above report.
Let's consider a simpler example:


scribus-test/
├── scribus-folder
│   ├── image.png
│   └── test.sla
└── scribus-link -> scribus-folder


We have a test-dir containing a folder "scribus-folder" and a symbolic link to it called scribus-link.
scribus-folder (and scribus-link too) contains two file, an image and our SLA document.
By opening SLA file from within scribus-link, and load the image in scribus-link, the PFILE var will be set to "../../scribus-link/image.png" and not to "image.png" as we should expect.

To reproduce this sort of bug:
- go in scribus-link (it should be seen as a folder by whatever filemanager or also by scribus itself if you open it from within scribus "file>open"
- now open SLA file
- add an image frame and load "image.png" (it's in the same dir of SLA file)
- then save SLA document
- now check same document by opening it with a text editor, look at "PFILE=" variable.
- it should be set to "../../scribus-link/image.png"

I would consider it a bug, because path to image is not actually relative to the current dir of our SLA document.
This bring to missing image if we remove "scribus-link" or just point it to another project directory.
Hope my english was as clear as needed to explain this "issue".

In the mean time I'll fix by not using that symbolic link anymore, and by edit my old SLA documents with sed or something similar (fortunately SLA file is just simple XML document, easy to apply automated edit procedures).