Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ImageUploader doesn't work

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

Page: 1
Go to End
Author Topic: 1485 Views
  • Jarek
    Community Member
    30 Posts

    ImageUploader doesn't work Link to this post


    I'm trying to add image field. According to tutorial, this code

    static $has_one = array(
    'Photo' => 'Image'
    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
    return $fields;

    should work. But I'm getting error

    FATAL ERROR: i18n::include_by_class: Class ImageUploader not found
    At line 1258 in D:\htdocs\pss\sapphire\core\i18n.php

    user_error(i18n::include_by_class: Class ImageUploader not found,512)
    line 1258 of i18n.php

    line 134 of Core.php

    _t(ImageUploader.ATTACH,Attach %s,50,Attach image/file)
    line 535 of Image.php



    In sources I've found class Image_Uploader. Is this correct name of image class? What should I do to run this code?

  • Jarek
    Community Member
    30 Posts

    Re: ImageUploader doesn't work Link to this post


    I've found solution. Problem isn't in class name but in code that create strings (in methods EditImageForm and DeleteImageForm). This code doesn't work:

    $title = sprintf(         
       _t('ImageUploader.REPLACE', "Replace %s", PR_MEDIUM, 'Replace file/image'),
    $fromYourPC = _t('ImageUploader.ONEFROMCOMPUTER', "With one from your computer");
    $fromTheDB = _t('ImageUplaoder.ONEFROMFILESTORE', "With one from the file store");

    but after replacing to this:

    $title = 'Replace file/image';
    $fromYourPC = 'With one from your computer';
    $fromTheDB = "With one from the file store";   

    everything is ok

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.