# SOLVED - Get Thumbnail API PHP

**URL:** <https://discourse.getcockpit.com/t/solved-get-thumbnail-api-php/870>\
**Category:** Support\
**Created:** [June 13, 2019, 4:09am UTC](https://discourse.getcockpit.com/t/solved-get-thumbnail-api-php/870 "2019-06-13T04:09:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![putude](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/putude/32/254_2.png) [@putude](https://discourse.getcockpit.com/u/putude)\
**Post date:** [June 13, 2019, 4:09am UTC](https://discourse.getcockpit.com/t/solved-get-thumbnail-api-php/870/1 "2019-06-13T04:09:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [June 13, 2019, 6:19pm UTC](https://discourse.getcockpit.com/t/solved-get-thumbnail-api-php/870/2 "2019-06-13T18:19:34Z")

</div>

Try this:

```php
$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](https://github.com/agentejo/cockpit/blob/next/modules/Cockpit/bootstrap.php#L105)

---

<div class="post-metadata">

**Author:** ![putude](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/putude/32/254_2.png) [@putude](https://discourse.getcockpit.com/u/putude)\
**Post date:** [June 14, 2019, 12:21am UTC](https://discourse.getcockpit.com/t/solved-get-thumbnail-api-php/870/3 "2019-06-14T00:21:11Z")

</div>

Hi @raffaelj,

Thank you for your solution. It’s working!!

Putude
