Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

17478 Posts in 4473 Topics by 1972 members

Archive

SilverStripe Forums » Archive » Problem with images

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

Page: 1
Go to End
Author Topic: Problem with images 802 Views
  • blaater
    avatar
    Community Member
    22 posts

    Problem with images Link to this post

    Hello,

    I've got a problem with some images in SS. I have a class 'oProfileMdl' which first extended from DataObject, but now from Member because I needed the fields from this class in the CMS. Now the images don't show up on the website. At first it worked fine. The code I'm using in the template is:

    <% control Foto %>
    <% control CroppedImage(103,105) %>
    <img src="$URL" alt="Bekijk het profiel van '$FirstName $Surname'" title="Bekijk het profiel van '$FirstName $Surname'" width="103px" height"105px" />
    <% end_control %>
    <% end_control %>

    I just pass it a DataObject like I normally do, also when I put the $FotoID in the link it is visible.

    Also I've created a form which edits the profile, when when i put the following code in it SS gives a error: Method 'Foto' not found in class 'Member'

    new SimpleImageField('Foto','Uw pasfoto:'),

    In the oProfileMdl there is a static $has_one

    static $has_one = array(
          'Foto' => 'Image'
    );

    Does anybody know a solution?

    Thanks!

  • spenniec
    avatar
    Community Member
    37 posts

    Re: Problem with images Link to this post

    blaater,
    You would refer to Foto in the template as $Foto unless you had a method in the class file which was called Foto, which you don't hence the error: Method 'Foto' not found in class 'Member'.

    Why does oProfileMdl extend Member?

  • Willr
    avatar
    Moderator
    2727 posts

    Re: Problem with images Link to this post

    If you are using member you might want to make sure you added the extension to it in your _config file -

    DataObject::add_extension('Member', 'MyCustomMember');

    See the forum module for how it extends the member class

    802 Views
Page: 1
Go to Top

Currently Online: Motoma, Kiran, lise, Mohammed, steve_nyhof, Thomas B. Nielsen

Welcome to our latest member: jhstripe

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

Comments on this website? Please give feedback.