putude
June 13, 2019, 4:09am
1
Hi, master.
Please help me, how to get the thumbnail by using PHP API?
I tryed
$thumbnail = cockpit(‘mediamanager:thumbnail’, $image, 200, 200);
it produces the following error:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in {my path} on line 274
Thank you,
Putude
Try this:
$options = [
'src' => $src, // path or id
'mode' => 'thumbnail',
'width' => 200,
'height' => 200,
'quality' => 80,
];
// thumbnail() function is part of the cockpit module
$thumbpath = $app->module('cockpit')->thumbnail($options);
// or:
// $thumbpath = cockpit('cockpit')->thumbnail($options);
See also: https://github.com/agentejo/cockpit/blob/next/modules/Cockpit/bootstrap.php#L105
1 Like
putude
June 14, 2019, 12:21am
3
Hi @raffaelj ,
Thank you for your solution. It’s working!!
Putude