Skip to content

Use alias or Twig for asset path #583

@gmhenderson

Description

@gmhenderson

Description

Is it possible to use an alias or to parse Twig in that path supplied for an Asset import? Consider a feed source like:

[
  {
    "title": "My Image",
    "path": "@myAlias/feeds/myimage.jpg",
    "filename": "myimage.jpg"
  }
]

or

[
  {
    "title": "My Image",
    "path": "{{ alias('myAlias') }}/feeds/myimage.jpg",
    "filename": "myimage.jpg"
  }
]

I have enabled Twig parsing in the FeedMe config with 'parseTwig' => true, but I get an error:

↳ Uploads: Asset error: @myAlias/feeds/myimage.jpg - fopen(@myAlias/feeds/myimage.jpg): failed to open stream: No such file or directory

Is there any way to have a dynamic path value for the asset import? What exactly does the parseTwig option allow for?

Additional info

  • Plugin version: 4.1.1
  • Craft version: 3.2.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions