text stringlengths 0 106k |
|---|
.container { |
padding: 2rem; |
} |
.input-container { |
text-align: left; |
width: 100%; |
} |
.form-label { |
font-size: 0.8rem; |
font-weight: bold; |
color: #333; |
margin-bottom: 0.5rem; |
} |
.form-control { |
height: auto; |
font-size: 1.2rem; |
overflow: hidden; |
resize: none; |
} |
.btn { |
height: 3rem; |
font-size: 1.2rem; |
width: 100%; |
} |
function isMobile() { |
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); |
} |
let textareas = document.querySelectorAll('textarea'); |
textareas.forEach(textarea => { |
textarea.addEventListener('input', autoResize, false); |
}); |
function autoResize() { |
this.style.height = 'auto'; |
this.style.height = this.scrollHeight + 'px'; |
} |
['Imagine', 'Replicate', 'Leonardo', 'PlaygroundAI'].forEach(provider => document.getElementById('provider').add(new Option(provider, provider))); |
document.getElementById('provider').value = 'Leonardo'; |
['SDXL', 'Stable Diffusion 2.1', 'Stable Diffusion 1.5', 'Playground V1'].forEach(model => document.getElementById('model').add(new Option(model, model))); |
document.getElementById('model').value = 'SDXL'; |
['Photoreal', 'Pixar 3D', 'Painting', 'None'].forEach(style => document.getElementById('style').add(new Option(style, style))); |
document.getElementById('style').value = 'None'; |
['16:9', '9:16', '4:3', '3:4', "3:2","2:3","1:1"].forEach(ratio => document.getElementById('ratio').add(new Option(ratio, ratio))); |
document.getElementById('ratio').value = '16:9'; |
document.querySelector('.btn').addEventListener('click', generateImages); |
function generateImages() { |
// Get the values from the form inputs |
let provider = document.getElementById('provider').value; |
let model = document.getElementById('model').value; |
let style = document.getElementById('style').value; |
let ratio = document.getElementById('ratio').value; |
let numImages = document.getElementById('num-images').value; |
// Generate the URLs |
let urls = []; // replace this with the logic to generate the URLs |
for (let i = 0; i < numImages; i++) { |
// Add logic here to generate each URL based on the form values |
// For now, I'll just add a placeholder URL |
urls.push('http://example.com/image' + i + '.jpg'); |
} |
urls = ["https://i.ibb.co/k0W6V1v/Dream-Shaper-v7-blonde-hermione-emma-watsonpink-dress-silver-ti-3.jpg", |
"https://i.ibb.co/4tVHbcq/Dream-Shaper-v7-blonde-hermione-emma-watsonpink-dress-silver-ti-2.jpg", |
"https://i.ibb.co/wLzpXb2/Photo-Real-blonde-hermione-emma-watsonpink-dress-blushing-weddi-0.jpg", |
"https://i.ibb.co/pjbT6Gd/Photo-Real-blonde-hermione-emma-watsonpink-dress-silver-tiara-b-1.jpg",] |
// Display the images |
let imageContainer = document.createElement('div'); |
imageContainer.style.display = 'flex'; |
imageContainer.style.flexWrap = 'wrap'; |
imageContainer.style.marginTop = '20px'; |
imageContainer.style.justifyContent = 'space-around'; |
urls.forEach(url => { |
let img = document.createElement('img'); |
img.src = url; |
img.style.width = isMobile() ? 'calc(100% - 20px)' : 'calc(50% - 20px)'; |
img.style.height = 'auto'; |
img.style.margin = '10px'; |
imageContainer.appendChild(img); |
}); |
// Add the image container to the DOM, right after the Generate button |
document.querySelector('.btn').after(imageContainer); |
} |
Make the images have rounded corners |
[AI]: To make the images have rounded corners, you can use the `border-radius` property in CSS. `border-radius` sets the rounding of the corners of an element. It can take values in px or %, and the higher the value, the more rounded the corner will be. |
Here's the modified code: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.