Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Show The Image Filename & Path Only NOT <img src="

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

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

Page: 1
Go to End
Author Topic: 2064 Views
  • brandstudio
    Avatar
    Community Member
    5 Posts

    Show The Image Filename & Path Only NOT <img src=" Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Show The Image Filename & Path Only NOT <img src=" Link to this post

    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 %>

    2064 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.