How to display an image from Finder?

Hello,

Sorry if this is a realy basic question but I see in documentation how to diplay an image :

<img src="/api/cockpit/image?token=xxtokenxx&src=path&w=200&h=200&f[brighten]=25&o=true" />

But when I do it, there is no disply the image, as when the src is wrong.

Is it the good way ?

Thanks you.
Nicolas.

If you upload images via Finder or via image field in a collection, the files are - just files somewhere on your server. Use assets instead to have database entries for each image and than you can query them via image id or image path.

See this thread for some more info about the differences between images and assets: "Select Image" results in "Something went wrong" on asset field

<img src="/api/cockpit/image?token=xxtokenxx&src=path&w=200&h=200&f[brighten]=25&o=true" />

Without o=true you receive a relative url to the generated thumbnail. With enabled output, you receive the whole image.

I’m not sure, but I think I had some problems querying assets with relative urls when a part of the subdirectory is missing… If so, use the image id instead &src=image_id.

I find the problem “o=1” instead of “o=true” work fine :wink:

1 Like

Someone really needs to update the docs with this little nugget! Cheers nkondratek :sweat_smile: