Skip to content

Random Image Generator #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Picsum-api-for-random-image-generator-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Random image generator using picsum api

Output :-

https://siddhesh172004.github.io/Picsum-api-for-random-image-generator/
19 changes: 19 additions & 0 deletions Picsum-api-for-random-image-generator-main/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

let formss=document.getElementById("formsss")
let width=document.getElementById("width")
let height=document.getElementById("height")

height.addEventListener('keyup', (e)=>{
(e.keyCode === 13 ? formss(e) : null);
})


formss.addEventListener('submit',function(e){
e.preventDefault()

let image=document.getElementById("img")

let links="https://picsum.photos/"+width.value+"/"+height.value
image.src=links
// alert("https://source.unsplash.com/random/"+width.value+"*"+height.value)
})
35 changes: 35 additions & 0 deletions Picsum-api-for-random-image-generator-main/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<title>Siddhesh Random image generator</title>
</head>
<body>
<div class="container" style="width: 70%;">
<h1>Generate images</h1>
<form id="formsss">
<div class="form-group">
<input class="form-control" type="number" id="width" placeholder="enter the width of image " required>
</div>
<div class="form-group">
<input class="form-control" type="number" id="height" placeholder="enter the height of image "required>
</div>
<div class="form-group">
<input class="btn btn-primary btn-lg" type="submit" id="height">
</div>

</form>
<img id="img">
</div>




</body>
<script src="api.js"></script>

</html>