Token to get a file uri?

Created on 28 August 2023, about 1 year ago

I have the metatag β†’ module installed, which provides an interface to specify values, including tokens, for outputting as <meta> tags on pages.

Is there a way to specify a token to get the URI (or any other property) of an arbitrary file that was uploaded to the site?

I'm hoping to be able to enter a token that may look like either of the following, where 12345 is a file's FID:

[file:12345:uri]
[file_entity:12345:uri]

Is that possible? And do you know if it's possible to get other file attributes for images like alt, title, width, height, etc?

For clarity... I don't want my token to depend on a file in a field on a node, but rather I want to just specify the FID for a file that could have been uploaded anywhere on the site. (And of course I would expect there to be an access check during file_load() or some such thing to make sure the file is viewable by the user/anonymous.)

πŸ’¬ Support request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States hargobind Austin, Texas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024