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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Need Image link without the 'img src' tag


Go to End


2 Posts   1573 Views

Avatar
Snowlord

Community Member, 7 Posts

8 December 2011 at 12:39pm

I'm trying to add the ability to insert an image into the background of a div. I have my CSS:

-----------
<style type="text/css">
.mainBackground {
background: #000 url('$BackgroundImage') no-repeat left top;
}
</style>
-----------

And added the proper tab into the php page:

-----------
$fields->addFieldToTab("Root.Content.Images", new ImageUploadField('BackgroundImage', 'Background Image'));
-----------

Everything functions as expected EXCEPT, it adds in the '<img src' tag (as it should). Is there a way to have the same functionality, only JUST insert the actual image path WITHOUT the 'img src' tag or the 'alt' tag?

Thanks!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

10 December 2011 at 4:12am

$BackgroundImage.URL

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com