Feature request #12688
relative paths in image source expression
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Nathan Woodrow | ||
Category: | Expressions | ||
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Easy fix?: | No | Copied to github as #: | 20794 |
Description
I have an atlas with a QR code on each page. the qr codes are jpg images stored in a folder relative to the project root. I use dropbox to sync the project file to multiple users / computers.
The qr filenames are attributes in a field. (i.e. "001.jpg", "002.jpg" etc..)
I used expression builder to concatenate the strings to a usable path:
'c:/path/to/my/project/qr/' || "fileName"
which works fine but I want it to be portable so instead I would like to be able to use:
'qr/' || "filename"
but it doesn't work. I created a workaround using a python function that returns the current path:
$currentpath || '/qr/' || "filename"
which works ok but then I have to put the function in every new computer I access the file from.
ultimately it would be more intuitive and work better if the relative paths just worked (or if there was a current path variable to concatentate to)
History
#1 Updated by Nathan Woodrow over 9 years ago
The expression parser isn't going to know if 'qr/'
is a string or a path, making it guess would be a bad thing.
Adding a project path variable would be fine though so we could do that.
#2 Updated by Nathan Woodrow over 9 years ago
- Tag set to expression
- Assignee set to Nathan Woodrow
- Category set to Expressions
#3 Updated by Jesse McMillan about 9 years ago
That would be perfect. Very useful for collaborations.
#4 Updated by Nathan Woodrow about 9 years ago
- Status changed from Open to Closed
- Resolution set to fixed/implemented
This is now possible in the latest version using the @project_path variable.