Is there a way in P&T Assets to output just the file's relative url path without the filename?

For instance, I'm trying to call a file's retina image.

This is the normal file output:


Which results in:


But I'm looking to obtain this output instead:

   /path/to/file/[email protected]

I thought this could be accomplished with...


... but this results in ...

   [email protected]

What is subfolder supposed to output if not /path/to/file/? Is there another way to grab the relative path?

2 Answers 2


Have you tried {url} or {server_path}? I suspect that {subfolder} (confusingly) refers subfolders of existing EE File Upload paths (i.e. subfolders that Assets recognizes, but EE does not).

  • I never thought I'd use this sentence in my life, but here goes: "Sandwich is right on this one." Currently there is no great way of accomplishing what you need - subfolder refers to the folder structure within the source already. Without modifying Assets your best bet would be using another add-on to tweak the URLs or using PHP in this template on template output stage. Sep 16, 2013 at 5:33
  • Yeah, I was going to use PHP to grab the relative path from the {url} or {serverpath}, I was just hoping I didn't have to. I work locally and push to production, so it kind of makes it a little more messy than I'd like. Oh well. Thanks!
    – xxx
    Sep 16, 2013 at 20:45

Ended up using php to grab the relative path by subtracting {filename} from {url}.

    $url       = "{image_blog}{url}{/image_blog}";
    $filename  = "{image_blog}{filename}{/image_blog}";
    $extension = "{image_blog}.{extension}{/image_blog}";
    $needle    = $filename . $extension;
    $relative  = str_replace($needle,"",$url);
    $retina    = $relative . $filename . "@2x" . $extension;
    echo $retina;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.