Tags
Asked 2 years ago
6 Jul 2022
Views 383
angeo

angeo posted

generate unsplash random image

how to generate random image with upsplash ?
joomler

joomler
answered Nov 30 '-1 00:00

get random image url from picsum.photos :


https://picsum.photos/100/100?random=123
https://picsum.photos/100/100?random=323


it useful when showing multiple image in same web page , it will give you unique image to every random value
dilip

dilip
answered Nov 30 '-1 00:00

random image url :

https://source.unsplash.com/random


put following url in img src , it will show you random image at every refresh


<img src="https://source.unsplash.com/random"
/>


it will show you full size image until
you define the size


<img src="https://source.unsplash.com/random" width="100" height="100"
/>


but very good to use like below



<img src="https://source.unsplash.com/random/100×100" width="100" height="100"
/>


random image with search :

as you can see i put size and after that search for garden related images

<img src="https://source.unsplash.com/random/100×100/?garden" width="100" height="100"
/>





Post Answer