Filestore and images... how to show thumbnails in the grid instead of file name?


#1

I am using Filestore that I had to install it manually since it is not working the composer install…

I have relational tables 1 : N

and I am using mastercrud and I wonder how to display instead of the image name the image itself as a inside the grid

is that possible?

also how can I say to mastercrud to show specific columns of the first table and the relational table?

I have this code now and for both tables the same columns are shown and it is incorrect:

$app->cdn['atk'] = '../public';
$mc = $app->add([
    '\atk4\mastercrud\MasterCRUD',
    'ipp'=>5,
    'quickSearch'=>['name'],
    'fieldsRead'=>['name','img_filename']
]);
$mc->setModel(new Deal($app->db), 
    [
        'DealDates'=>['DealDates'=>['CRUD', 'canDelete'=>false, 'ipp'=>5, 'fieldsRead'=>['name'] ]],
    ]
);

the first table must show only ‘fieldsRead’=>[‘name’,‘img_filename’] columns
but the clicked second table in relation with the first one must show only ‘fieldsRead’=>[‘name’,‘date’]

the problem that for both the grid shows the same columns!!

how can I use it in a way I can display different columns in the grid for different tables?
thanks


#2

regarding the columns - seems like a bug.


Uploading Files inside Form
#3

yes it seems like a bug to me too…

talking about showing images instead of text name of the image is it there a solution to display that this way like in the image I create ?

it will be nice also in edit mode to show the thumbnail of the image uploaded too so I know which image it is before replacing it…


#4

here the sample of edit mode: it will be nice to have something like this to show the image above the name in edit mode so I can edit the image and know before changing it if this is the image I need to replace…


#5

my other idea will be better to use fileinput.js in my semantic panels I incorporated this as the file input field and works best because you can use it for a set of images or just one… it is compatible with semantic too… the only thing I do not know how Agile Toolkit works to add this as a plugin because I am new in Agile toolkit now… but it will be nice to have it working in this case with drag and drop areas…

to see It in action here
http://plugins.krajee.com/file-input

my sample screen using it it looks like this:

it will be nice to have in Agile something like this!!
it is awesome to have file uploads and see the thumbs before and after uploaded and be able to delete them too easily visually…

:slight_smile:


#6

yes the bud if fixed the problem it is here inside MasterCRUD.php:

function getCRUDSeed($defs)
{

    $seed = isset($defs[0]) ? $defs[0]: [];

    $result= $this->mergeSeeds(
        $seed,
        $this->_missingProperty,
        [ 'CRUD', ]
    );
    return $result;
}

the correct will be:

function getCRUDSeed($defs)
{

    $seed = isset($defs[0]) ? $defs: [];

    $result= $this->mergeSeeds(
        $seed,
        $this->_missingProperty,
        [ 'CRUD', ]
    );
    return $result;
}

before:
$seed = isset($defs[0]) ? $defs[0]: [];

After:
$seed = isset($defs[0]) ? $defs: [];

$defs returned if not empty should be $defs not $defs[0]

in my case it fixed everything this and now I can filter relational tables with fieldsRead too…

:slight_smile: