jalendport / craft-fetch

Utilise the Guzzle HTTP client from within your Craft templates.
MIT License
24 stars 13 forks source link

Decoded images with parameter false #5

Open JonnyBR12 opened 5 years ago

JonnyBR12 commented 5 years ago

Hey there! Not sure if this is something I'm doing wrong with the plugin or something I need to resolve outside of it so apologies if it's the latter.

I'm using Fetch (thanks!) and trying to get an image from an endpoint which in the docs, should return as a string. When I add the parameter 'false' I get a character blob (attached screenshot snippet). Without 'false', I get NULL returned. Is this what should be happening or is there something I can add to the options to pull this through?

Any help would be really appreciated.

blob

The cURL request I'm trying to replicate with Fetch is:

curl -X GET "https://XXXXX/image/XXXXX/XXXXX/12345" -H "accept: image/jpeg" -H "Authorization: Basic XXXXX"

My current code is:

{% set imageOptions = {
headers : {
    Authorization: ['Basic XXXXX'],
    Accept: 'image/jpeg',
}
} %}
{% set image = fetch(client, 'GET', 'image/XXXXX/XXXXX/12345', imageOptions, false) %}`