Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Show The Image Filename & Path Only NOT <img src="


Go to End


2 Posts   3077 Views

Avatar
brandstudio

Community Member, 5 Posts

3 May 2008 at 2:30am

Edited: 03/05/2008 2:31am

Hi there.

Problem: I add an image field to the backend and currently displaying
the image using..

$Photo2.SetWidth(180)

This prints out <img src="uploads/blahblah.jpg"> and shows the image fine
however.. I only want to echo the filename and location example: uploads/blahblah.jpg

I intend to then load this image into flash. How could I get it to simply echo the filename?
I realise I need to somehow grab it from the file table and refence the Photo2 field but not sure how to execute this within the structure.

thanks in advance : )

Sefton

Avatar
Willr

Forum Moderator, 5523 Posts

3 May 2008 at 6:35pm

You can call the URL method on the Image. Try $Photo2.SetWidth(180).URL Not sure if you can chain it like that, you probably can't :(. Maybe then try <% control Photo2.SetWidth(180) %>$URL<% end_control %>