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

Missing thumbnails and content images


Go to End


9 Posts   3448 Views

Avatar
Stagen

Community Member, 5 Posts

18 March 2011 at 1:52am

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:

Avatar
Stagen

Community Member, 5 Posts

24 March 2011 at 4:10am

Bump!

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

Avatar
hammuh

Community Member, 15 Posts

24 March 2011 at 4:27am

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.

Avatar
Stagen

Community Member, 5 Posts

24 March 2011 at 4:37am

Edited: 24/03/2011 4:39am

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.

Avatar
honeybunny

Community Member, 79 Posts

24 March 2011 at 4:44am

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

Avatar
Stagen

Community Member, 5 Posts

24 March 2011 at 4:46am

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

Avatar
hammuh

Community Member, 15 Posts

24 March 2011 at 4:52am

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!

Avatar
Stagen

Community Member, 5 Posts

24 March 2011 at 5:04am

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.

Go to Top