cdaguerre / php-trello-api

A simple Object Oriented wrapper for the Trello API, written in PHP5.
http://cdaguerre.github.io/php-trello-api
MIT License
254 stars 120 forks source link

Create a card with image #75

Closed shryder closed 5 years ago

shryder commented 5 years ago

How can I set a card's image? I checked https://developers.trello.com/reference#cards-2 to see how the api does it and tried this but doesn't work. Says that the fileSource is invalid.

How raw request should look like: curl --request POST \ --url 'https://api.trello.com/1/cards?idList=idList&fileSource=data%3Aimage%2Fpng%3Bname%3Dcoolscreenhot.png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAANUAAAAsCAMAAA&keepFromSource=all'

How I tried doing it:


$this->client()->cards()->create([
    'idList' => 'listhere',
    'name' => 'name here',
    'desc' => 'cool description',
    'fileSource' => 'data:image/png;name=test.png;base64,' . base64_encode(Storage::disk('local')->get('image.png')), 
]);
shryder commented 5 years ago

Nevermind, I'm supposed to create a new attachement inside that card.