Forum

Thread tagged as: Question

How do I return the name of an image without the path or suffix?

I have a page attribute declared allowing the user to specify a 'Featured Image'. I wish to use the name of the image in a navigation template.

I'm using the following tag:

<perch:pages id="pageImage"/>

Currently returns the image and the full path, filename and suffix:

/perch/resources/image-name.jpg

What I would like is:

image-name

No path, no suffix.

Is this possible?

Tony Astley

Tony Astley 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You would need to get the path into a variable, and then get the name out with a bit of PHP string manipulation.

Thanks Rachel.