+ 5
Set the height & width, text b/w the two images
I want to set the height & width of that image and I want to also write the text between the two images, I already google it but the nothing it shows through urllib module.
22 Antworten
+ 3
Ok so use os module and import the images as usual
https://code.sololearn.com/c9hQ1gXIZ9oU/?ref=app
+ 2
Ugulberto Sánchez doesn't matter the height and width should be fixed but at least I want to show the text b/w the two images, that's the main problem
+ 2
Sakshi (less active) Did you quit display: none From img css rule?
+ 2
Oh, I don’t know what is not working. Wait a moment
+ 2
Ok show your code
+ 2
Ugulberto Sánchez I also tried in another way also, btw leave it that problem is not solved & thank you bro for help 😊
+ 2
xd there aren’t images displayed in the screen, you have to put an img tag like in html to display that
+ 2
Ugulberto Sánchez I also tried in image tag bro
+ 2
Sakshi (less active) oh! So I don’t know what to do, I’m not experienced with python html :((
+ 2
Ugulberto Sánchez no problem bro, I tried also different module like Pillow module but the problem is same, main problem is the text is show above the image not showing in b/w.
+ 2
Ezekiel James Ngà Lê Vĩnh STOP SPAMMING.
+ 2
Hey Sakshi sis can I see your code 😎 I wanna try, I think I can do it
+ 2
If you want to set the height and width of an image using the urllib module in Python, you can first download the image using urllib and then use an HTML template to display the image with the desired dimensions and text.
import urllib.request
image_url = 'https://example.com/image.jpg'
urllib.request.urlretrieve(image_url, 'image.jpg')
# Set the desired height and width
image_height = 200
image_width = 300
html_code = f'''
<!DOCTYPE html>
<html>
<head>
<style>
.container {{
display: flex;
justify-content: center;
align-items: center;
}}
.image {{
height: {image_height}px;
width: {image_width}px;
}}
.text {{
margin: 0 20px;
font-size: 20px;
}}
</style>
</head>
<body>
<div class="container"> <img class="image" src="image.jpg" alt="Image"> <span class="text">Your Text Goes Here</span> <img class="image" src="image.jpg" alt="Image"> </div> </body> </html> '''
with open('output.html', 'w') as f:
f.write(html_code)
+ 1
Ugulberto Sánchez bro I tried the html also but the image is not showing
+ 1
Ugulberto Sánchez I use img and then put the image in src attribute instead of display: none, but the image is not showing
+ 1
Mirielle Oh ok , Thank you so much mam for telling me, otherwise I am tired to try it again and again 😅
0
if 3 of the people will be the boolean of the comma so the function of the unicode is that the license will be C. that what happened in JS
0
i am learning the intro of python and HTML these type of qs confuse me yaar 😩😩😩
0
ANIMESH DINDA don't advertise the code here