Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Missing thumbnails and content images

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1511 Views
  • Stagen
    Avatar
    Community Member
    5 Posts

    Missing thumbnails and content images Link to this post

    This is basically a continuation of this topic here: http://www.silverstripe.org/general-questions/show/15146

    It's about an issue with DataObject_Manager, or so it's believed. While there's been a few suggestions on how to fix it in that thread, I haven't had any success in fixing the problem on my site.

    To sum it up, here's my scenario:

    • DataObject_Manager and Uploadify are installed and of the latest trunk build from github.
    • I've successfully uploaded images to the archive through File Management.
    • As I attempt to add images from the archive to a page, it just will not work.
    • Images attached show up as default thumbnail icons and aren't in fact attached at all.

    Like so: http://cl.ly/5IQq

    I have no idea what's going on, or how to fix it.

    Halp! This project is already delayed, I want it finished already! D:

  • Stagen
    Avatar
    Community Member
    5 Posts

    Re: Missing thumbnails and content images Link to this post

    Bump!

    Is there anyone with the least bit of an idea as to what could be causing this?

  • hammuh
    Avatar
    Community Member
    15 Posts

    Re: Missing thumbnails and content images Link to this post

    Hi Stagen,

    The ImageDataObjectManager is managing DataObjects witch contains Images. Can you post the code of the ImageDataObjectManager (field) in getCMSFields() and the code of the DataObject you want to manage.

  • Stagen
    Avatar
    Community Member
    5 Posts

    Re: Missing thumbnails and content images Link to this post

    Yes, of course I could do that, here we go. I've made the following, which have worked fine in previous sites that I've made:

    PageImage.php

    <?php

    class PageImage extends DataObject {
    static $db = array (
    'Name' => 'Text',
    'Description' => 'Text',
    );

    static $has_one = array (
    'Attachment' => 'File',
    'Page' => 'Page'
    );

    public function getCMSFields_forPopup_pageimage() {
    return new FieldSet(
    new TextField('Name'),
    new TextField('Description'),
    new FileIFrameField('Attachment')
    );
    }
    }
    ?>

    and in the pages

    GalleriSide.php

    <?php
    class GalleriPage extends GalleriHolder {

       public static $db = array(
       );

       public static $has_one = array(
          'GalleriBillede' => 'Image'
       );
       
       public static $has_many = array(
          'Galleri' => 'PageImage'
       );
       
       public static $many_many = array(
       );

       
       public function getCMSFields() {
          $fields = parent::getCMSFields();
             
          $fields->addFieldToTab("Root.Content.Galleri", new ImageField('GalleriBillede', 'Galleri billede'));
          
          $manager = new ImageDataObjectManager( // Galleri Udtræk
          $this,
          'PageImages', // Source name
          'PageImage', // Source class
          'Attachment', // File name on Data Object
          array(
             'Name' => 'Picturename',
             'Description' => 'Description'
          ),
          'getCMSFields_forPopup_pageimage'
          );
          $fields->addFieldToTab("Root.Content.Galleri",$manager);
       
          return $fields;
       }
       

    }
    class GalleriPage_Controller extends GalleriHolder_Controller {

       public static $allowed_actions = array (
       );

       public function init() {
          parent::init();

          Requirements::themedCSS('galleri');
          
       }
    }

    I hope it makes sense. I'm not much of a programmer, I'm primarily a front end dev.

  • honeybunny
    Avatar
    Community Member
    79 Posts

    Re: Missing thumbnails and content images Link to this post

    Hi Stagen!
    I'm having a similar problem with the image gallery. I can upload directly into the gallery but any attempt to load something that already exists in the assets directory results in a generic place holder graphic. The weird thing is that yesterday I couldn't upload images, but I could grab pics that already existed. I "fixed" the upload issue by adding

    <IfModule mod_security.c>
    SecFilterEngine Off
    </IfModule>

    to .htaccess, but then I lost the ability to load from assets.

    HB

  • Stagen
    Avatar
    Community Member
    5 Posts

    Re: Missing thumbnails and content images Link to this post

    Does indeed sound a lot like my issue too. Perhaps a server config issue?

  • hammuh
    Avatar
    Community Member
    15 Posts

    Re: Missing thumbnails and content images Link to this post

    Now were talkin'!

    In PageImage try this:

    static $has_one = array (
    'Attachment' => 'Image',
    'GalleriPage' => 'GalleriPage'
    );

    public function getCMSFields_forPopup_pageimage() {
    return new FieldSet(
    new TextField('Name'),
    new TextField('Description'),
    new ImageUploadField('Attachment')
    );
    }

    With Uploadify you can use the ImageUploadField()

    Make sure you run a 'dev/build', because Attachment will now be an Image in stead of a File and PageImage now has a relation with GalleriPage instead of Page.

    I hope it works out!

  • Stagen
    Avatar
    Community Member
    5 Posts

    Re: Missing thumbnails and content images Link to this post

    hammuh, I appreciate your assistance but that doesn't seem to help.

    I still can't select images from assets to use on the site.

    1511 Views
Page: 1 2
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.