Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDor Bar
8,410 PointsDifferent size pictures are't fit well. What to do?
I have a problem,
I have used different images in my portfolio, my images have different sizes and different ratio between width and height.
I used exactly the same code as in the video.
What to do?
5 Answers
Isaac Asante
4,752 PointsHey Dor, nope you won't be an "image cropper". It's all about setting a professional/pleasing layout. So how the images appear is entirely up to you, the way you like it. So you can have irregular images with different height, width and ratio, but they can still look alright so long as you're creative enough to display them in a way that won't add a bunch of white space below/besides the images. However, if you are creating a new website, it's always best to have a Style Guide with you, which will comprise a list of required rules to maintain your website's layout consistency.
So, for instance, you'd want to set a range of height and width (or ratio) for your images, just so you work on them directly as you save them on your local disk, before uploading them online. It's all about knowing your work and knowing how to keep it neat. As you build your website, you'll gradually know how to render/size the items it will contain.
It depends on the approach you choose to take. Hope I helped!
Isaac Asante
4,752 PointsFor the beauty of your own portfolio, especially considering it's an early course, I'd say the solution is to crop your images for them to have at least the same width.
Dor Bar
8,410 PointsIt seems that I don't know enough HTML to do it yet.
I will Google it... thanks!
Isaac Asante
4,752 PointsHey, you don't need knowledge in HTML to crop an image. You can use your normal Image Editor on Windows or Mac, whatever system you're using. Here's a short article with all the details: http://www.digitaltrends.com/computing/how-to-crop-a-photo-with-a-pc-or-mac/
Dor Bar
8,410 PointsSo, you mean that I need to make a preview for every picture manually?
Isaac Asante
4,752 PointsBasically, in CSS, you can set a specific width and height for every image for them to have a consistent layout. But the reason why I'm recommending cropping is because you said that your ratio was not equal, so in other to make them align properly and have a good look, you need to crop them and/or make the original image files have at least the same width.
Then you can think of the height after, if it still doesn't look good for you.
You get me? :)
Dor Bar
8,410 PointsYeah! got you.
But, I want to find a way that the browser will corp it automatically. I mean, I want to create a frame that will give me a preview, If I will add another 100 images and I will need to corp every single one of them I will not be a web developer, I will be "image corper" and that's not what I want.
kathrynpeterson
16,001 PointsI agree with what Isaac said. (Except for the typos--"in order to," rather than "in other to"--admitted "grammar nazi" here. 8^P ) I might just add, since I did the same thing you did, in terms of images irregularly-sized from those in the instructor's examples, that I found it looked better (and least stupid to my eye, as the browser window changed sizes) to put the relatively taller and thinner images (of which I had two) in the first two positions, the one that was shortest and widest, in the third position, and the remaining two that were roughly the same dimensions as the instructor's examples (of which I also had two) in the last two positions. I did scale the images in an image editor (I'm using Gimp, though I also have access to an older version of Photoshop) first, so that at least one dimension corresponded to the instructor's given dimensions of 1024 X 768px. The images all look as though they're the same width, though they actually aren't. (browser default, or something in the "normalize.css" maybe?) I haven't uploaded the file yet as a linked sub-domain to my existing demo domain site, (which is out-of-date and needs lots of work!) so I can't point you to look and see what I did, but I will do that soon.
Dor Bar
8,410 PointsDor Bar
8,410 PointsYou helped a lot!!
I have learned that I have much to learn and play with it more to get experience.
kathrynpeterson
16,001 Pointskathrynpeterson
16,001 PointsHey, Isaac, I just wanted to say that I thought your collective responses in this discussion thread constituted a "best answer" to the original question. You obviously know your stuff and how to present it, as well. Great job, IMHO!