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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

how to add URL links to images


Go to End


2030 Views

Avatar
oldwrinkly

Community Member, 34 Posts

26 June 2010 at 10:33am

Edited: 26/06/2010 10:56am

Using my localhost test site,
I have created a `sharepage` to link photos to forums, or friends to download,
I have used this code to show the images........

function FilesToDisplay() {
$dir = DataObject::get_one('Folder', "Filename='assets/ImageShare/'");
if ( $dir ) {
return DataObject::get('Image', "ParentID='$dir->ID'");
}

return null;
}

in template..............

<% control FilesToDisplay %>
$Tag
<% end_control %>
------------------------

This shows the images but the link it creates ie: http://localhost/silverstripe/ mysite/assets/ share/photo.jpg/

produces a `page not found`in a browser

I am stuck, can anyone help please

I really wanted a list of URL`s beside a thumbnail, I have tried several different dataobject codes but to no avail

Regards
Mike