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 do you get a resampled 100x100 image into a ComplexTableField?


Go to End


5 Posts   3940 Views

Avatar
Hammy

Community Member, 49 Posts

27 June 2009 at 11:04pm

Edited: 27/06/2009 11:06pm

I'm using a ComplexTableField to show a list of images and related information for each image in a dataobject. However when I call the image into the ComplexTableField I get the full image.

Is there a way of getting the 100x100 resampled image that is used to display the image in the popup in the CMS (the same one that appears after adding a new image in the image uploader)?

A snippet of the ComplexTableField is below:

...
/*****	Image List	*****/
		$RelatedImageList = new ComplexTableField(
			$this,
			'ProductImage',
			'ProductImage',
			array(
				'ProductImage' => ' Image',
				'ProductDetail.Title' => 'Product'
			),
			'getCMSFields_forPopup',
			'',
			'',
			'LEFT JOIN ProductDetail ON `ProductDetail`.ID = `ProductImage`.ProductDetailID'
		);
		$RelatedImageList->setParentClass('ProductList');
		$RelatedImageList->setShowPagination(false);
		$RelatedImageList->setPageSize(1000);
		$RelatedImageList->setAddTitle("Image");
		$RelatedImageList->setPopupSize("600px", "700px");

		$fields->addFieldToTab( 'Root.Content.ProductImages', $RelatedImageList );
...

Avatar
Hammy

Community Member, 49 Posts

30 June 2009 at 8:38am

Any takers with ideas on how to get a 100x100 image in the column?

Avatar
Carbon Crayon

Community Member, 598 Posts

30 June 2009 at 9:30pm

Edited: 30/06/2009 9:32pm

Hi Hammy

You can do this by calling the CMSThumbnail() function on the image. For a full explenation see this post on SSBits: http://ssbits.com/adding-a-thumbnail-to-a-dataobjectmanager-or-complex-table-field/

Avatar
Hammy

Community Member, 49 Posts

1 July 2009 at 8:21pm

Thanks Aram - worked a charm.

Avatar
biapar

Forum Moderator, 435 Posts

9 July 2009 at 7:24am

it goes...