PHP code example of nswdpc / silverstripe-imageselection-field

1. Go to this page and download the library: Download nswdpc/silverstripe-imageselection-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nswdpc / silverstripe-imageselection-field example snippets


$imageList = $app->getImageList();// DataList of Image records
$width = $app->getImageWidth();
$height = $app->getImageHeight();
$sampleImageField = ImageSelectionField::create(
    'SelectedImageID',
    _t(
        'myapp.CHOOSE_AN_IMAGE',
        'Choose an image'
    )
)->setDescription(
    _t(
        'myapp.CHOOSE_AN_IMAGE_HELP',
        'Choose an image that is most relevant.'
    )
)->setImageList($imageList)
->setImageDimensions($width, $height);