Hey Chris,
I think the API is better used for integrating images into products. For instance, if you had your own site creation tool and wanted to provide your users with free images, you could source them from Pexels via their API.
To use their images without loading them on your server is called “hotlinking.” You can insert images in WordPress posts via URL and use the URL of an image on their site instead of uploading to your Media Library. However, hotlinking is generally frowned upon. Some people view it as unethical since you’re eating up someone else’s resources without their permission.
If the issue is server space, then you could potentially use a platform like Google Photos (or Google Drive) that is designed to provide users with image storage and then hotlink from there.
-
This reply was modified 7 years, 3 months ago by
Ben Sibley.
Hi Ben,
Thanks for your thoughts: exactly what I was after.
The API doc can be found here: https://www.pexels.com/api/documentation/
It looks to me like hotlinking is exactly what it does, with the below provided line:
https://api.pexels.com/v1/photos/:id
(Insert an exact photo using its ID).
Is this practical to use for post feature images (I’m pretty sure you can specify dimensions), including acknowledgement of the author as the API requires?
Again, happy with a ‘no’ if it’s a lot of work.
I would recommend using the Featured Image from URL plugin instead. If hotlinking is okay with them as long as you provide a source then that plugin provides a simple way to add Featured Images via the URL.
Using the API would be much more work. You need to format the API requests like this using PHP and then write more code to integrate that with the WP post editor so you have an option in the interface to select the image you want to get.
Good answer, my friend. That tells me what I need to know.
I’ll stick to what I’ve got ( it’s working well, I’m just always considering tweaks when I come across them).
Thanks again.