Displaying images uploaded by users in a card with fixed dimensions - css

I want to allow the users of my site to upload images. Each person can submit one image. Then, this image will be displayed inside of a mat-card. I want it to look good on mobile, as well. I have very little experience with this, I don't know how to approach this problem.
Do I force some ratio of the image before I accept the upload? What if someone submits image like 1000x25? If the image is smaller than the card, is it best practice to stretch it to match the card's dimensions? Do I set the fixed width or height? Any pointers on how to approach this would be appreciated

Related

Image resizing issues

So im building my first wordpress site at the moment. Most problems i come across i just do a google search, read, learn, fix.
But one continuous problem i keep getting is images and resizing them.
Im really lost as to how it works, its so simple, yet i cant seem to manage them at all.
Heres some of my issues:
I'm using customizr theme, it has a slider, featured images for posts-big and small (featured image and thumbnail).
I resize the picture to the recommended dimensions, but it never seems to actually resize the picture in the box. And that's for all of them, the slider, thumbnail and featured image.
I toy with the dimensions to try to learn whats happening, but it just doesn't make sense to me, the box just zooms further into the image, the image doesn't actually move or try to fit at all when the dimensions are changed.
They also share the same image for the featured image and thumbnail, even if i click 'thumbnail only' and change the dimensions, it effects all of the images.
The slider images are always cut off, even if i change to the recommended dimensions. I've given up with the slider after a week of resizing, trying new sliders, adding slider codes into .php, enough.
But now this issue with a simple featured image and thumbnail is the last straw. So here it is, my cry for help!
How can i get control of my images, resize effectively, so i dont get these issues every time i try to add images into various functions.
Any help is much appreciated, thanks.

Image grid on website, can I scale images down with CSS?

I have a lot of images with a resolution around 500x1500 and I want to show all those images in a grid on my website. Each picture in the grid should be 200x200px.
If I scale down the images with CSS from 500x1500px to 200x200px and I show 10 200x200px images on my website, does this mean that the visitor first have to download the 500x1500px images and then their browser scales the pictures down?
If that is the case, then it's a bad solution to do it like this, right? Instead I should have two versions of each picture, one 500x1500px version and one 200x200px version. Am I right?
The question then is what's the easiest way to scale down hundreds of images?
Yes, I think it is the case that the browser will download the larger image and then scale it. You can check for yourself by opening the dev tools on the browser (press F12 if you're using Chrome) and monitoring the network traffic when you reload your site.
The easiest way to scale down hundreds of images is find or write a program to do it.
You are right. You can set height and width of the images but 1) the user will have to download a bigger image than necessary and 2) the height x width ratio will be trouble (the big one is 1x3 and the small one is 1x1). I would either use http://www.imagemagick.org/ , gimp or a similar tool to crop the images, but the problem is that the cropped area might not be very good. Only a human can select a good fit for the cropped area :-(
Edit1: Perhaps a well-trained neural network could select the most "interesting" part of every image programatically but that's kind of a lot of trouble to do that. Still it could be pretty interesting :-)

Header Image Sizing

URL to my website is http://chris-schilling-jksc.squarespace.com/
Password to get into site is fsj
I am using a Squarespace template which is causing me problems in making my main header image larger. Currently it is fairly zoomed in cutting off a lot of the picture. I am looking for some css to fix this problem. Squarespace templates are responsive making it hard to customize certain aspects. If someone knew a fix to my problem it would be greatly appreciated.
The reason the image is 'zoomed in' is because the background-size is set to cover. As the screen gets wider, the image must be stretched both horizontally and vertically to maintain the correct aspect ratio. The only real fix here would be to use a more narrow image, although it will then be 'zoomed in' at some aspect ratios on smaller screens.

Resize the Images Created from Bytes

I have multiple images on my website. But the images generate from bytes stored in the database. I generated the images from the byes and displaying it on my website. But he size of the images are very large(70 kg)per image. This is making slow down my site.
Is There any way to resize these images (12 kg). Please help me if anyone have solution.
Thanks in advance
You can create a custom handler that can create and return image. Along with that handler should set the changeability settings etc along with image re-sizing in order to get performance improvements.
Here is the one for example: http://webimageresizer.codeplex.com/
// Returns the image mapping to /bla.jpg resized to width of 100 pixels preserving aspect relative to height
http://webimageresizer.codeplex.com/ImageHandler.ashx?src=/bla.jpg&width=100
Let me know if you need more help.

ASP.NET use Ajax to add scrollbar to the picture

I need to add a scroll to "one" picture and load it asynchronously.. with the help of scroll bar...
The picture is bigger than the div area so need to scroll. I can use "overflow: scroll " but it loads the whole picture whereas my requirement is to load the picture as a user moves the scrollbar.
thanks
The would help to load a page with multiple large images in the manner you are describing
Lazy Load plugin
It isn't built for one giant sized image which is what you want. However it should be an easy matter to slice you image into reason sized regions or tiles and use this loader.
Out of interest really - here is a utility that will automatically slice up images to protect them from theft. I occurs to me that you could combine the two if you didn't fancy manually splitting the image - or just wanted to be a bit of a coding hero. In any case the link shows that sliced and recombined images look perfectly fine. Users can't tell if it's done right.

Resources