Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8599873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:29:25+00:00 2026-06-12T01:29:25+00:00

When images are placed in web documents using the <img /> elements/tag, should the

  • 0

When images are placed in web documents using the <img /> elements/tag, should the images to sliced and edited to fit the dimensions of the document or they should be placed as they are but the width and height attributes should be modified to fit the need.

For example if I have an image, say, “bldg_pic.png” which is 2000px wide and 1500px in height, And I want to place and fit it in a 400px X 300px <div>, should I leave the image unchanged and do as

<img src="bldg_pic.jpg" width="400" height="300" alt="Building Picture" />

So that the acutal image that loads is 2000px X 1500px but shows as 400px X 300px. Or do I just edit the image and make it smaller to 400px X 300px and use the same above code.

I assume that when placing images, the browsers acutally just inserts a “placeholder” for the image and if the height and width attributes are setup in front, the browsers know how much “space/memory” should be reserved for it.

I seek which method should be used and are their any performance/best pratices issues related?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:29:26+00:00Added an answer on June 12, 2026 at 1:29 am

    Always resize your images. Resizing your images on the fly is also possible.

    https://github.com/lencioni/SLIR

    SLIR is an awesome library. You take the slir folder, and put it in your website root. When you access images, you can do this:

        <img src="/slir/w400/path/to/image.png" width="400" />
    

    Lets assume that /path/to/image.png is 4000px wide, SLIR will not only compress the image, it will resize it, and store a cached version of this request in a folder on your server – when requested again, it will serve the cached version.

    If you need any help with file permissions, just ask.

    good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the ASP.NET AJAX TabContainer control in a web application. I've placed
So here is my plan for fast web page downloading... Place all images into
I have images placed in following path res>drawable>Images>Currencies>[All images] I have made a custom
I'm trying to get my UITableView to show cells with images placed on them
I am using following code to give round corners to the image placed on
in my project, i am using a ClientBundle for my images used in the
I need to place two images into top-left and top-right corners of a web
I'm very new to web programming and jQuery. I want to load images and
I recently ran into a problem with dynamically (lazy) loading images within elements (UIViewController-Subclasses)
Andy So I have this web application placed behind a loadbalancer. When a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.