[Solved] Strip path from picture

eurtnl

New Member
Hi there,

I'm using the upsert-plugin (form) to add/update another table. Now I need to insert/update the filename of a picture which is uploaded. So I use {picture_raw}, but it gives me the \path_to\picture.jpg.

how can I strip the path from {picture_raw}?
 
In the popup where you enter keys, values etc, you also have a dropdown "Eval the value as PHP". Set that to yes, then you should be able to return the value (in your case the placeholder) "wrapped" into a PHP function to strip the path.
See also the tooltip for the "Values" label.
 
Last edited:
What I tried is:
Key: Picture
Value: basename({picture_raw});
Default:
Eval: Yes

But when I add a new record I get 0 syntax error, unexpected '/'
 
As basically everywhere in Fabrik eval'd code (and indicated in my post), you need to return.
E.g.
Code:
return basename({picture_raw});

Often, if not always, it's also a good idea to put the placeholder in quotes, to avoid errors thrown in case it's empty: '{picture_raw}'
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top