Jump to:

23491 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » How do you get a resampled 100x100 image into a ComplexTableField?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 2772 Views
  • Hammy
    Avatar
    Community Member
    49 Posts

    How do you get a resampled 100x100 image into a ComplexTableField? Link to this post

    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 );
    ...

  • Hammy
    Avatar
    Community Member
    49 Posts

    Re: How do you get a resampled 100x100 image into a ComplexTableField? Link to this post

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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: How do you get a resampled 100x100 image into a ComplexTableField? Link to this post

    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/

  • Hammy
    Avatar
    Community Member
    49 Posts

    Re: How do you get a resampled 100x100 image into a ComplexTableField? Link to this post

    Thanks Aram - worked a charm.

  • biapar
    Avatar
    Forum Moderator
    435 Posts
    2772 Views
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.