DMarby / picsum-photos

Lorem Ipsum... but for photos.
https://picsum.photos
MIT License
2.21k stars 153 forks source link

Add Unsplash category selector #52

Closed kinnectus closed 5 years ago

kinnectus commented 5 years ago

Just found this most epic of sites and wondered if an Unsplash category filter could be added to only return photos from a specific category:

E.g. https://picsum.photos/200/300/?cat=textures-patterns

Use case: placeholder background where one doesn't want any object/person pictures to be returned, or only return pictures of people if one wants to demonstrate a person profile page.

DMarby commented 5 years ago

Hi!

We’re not planning to add this currently. I would recommend trying out https://source.unsplash.com if you want categories

broofa commented 3 years ago

Quick followup to help connect the dots for anyone looking for profile picture photos, you can get profile photo-like URL from unsplash as follows:

async function getRandomHeadshot(width, height) {
  const res = await fetch(`https://source.unsplash.com/${width}x${height}/?headshot`);
  return res.url;
}

[Edit: Actually, the above isn't working that well for me. Instead, I'm just generating random URLS to the images at https://randomuser.me/photos ]