Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Explicitly Size Images in a asp:Image without css/styles

Posted on 2013-05-16
9
Medium Priority
?
384 Views
Last Modified: 2013-07-05
As google is so into speed I want to Explicitly set the Size of Images without css.
If i use a html image can do this but would like to do it with an asp:image.

Does anyone know how to do this, after runing a test I am loosing 0.3 of a percent so must me important.
0
Comment
Question by:taz8020
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39174384
If the purpose is to improve performance, you want to resize image files on the server not the client controls. If the file to be download is still the same size, only shown smaller, then what's the benefit?
0
 
LVL 3

Author Comment

by:taz8020
ID: 39174564
yes but how to you state the size of an image in an asp image? if you set the hieght and width it always gets rendered as a style not image width etc
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39174632
All ASP controls end up rendered as HTML/Javascript in the browser.  The image control is no different.  

[CodeCruiser]'s point is perfectly valid.  Whatever size the browser renders the image, what matters for speed is the actual number of bytes being sent across the wire.  Resize the image itself, if you're really worried about speed.  Otherwise an ASP control is as good as an HTML control.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 3

Author Comment

by:taz8020
ID: 39174764
the images are the correct size but there are a few articles on lone saying about google is now looking for you to state the size of the image on the image. this way the page knows the size of each image before it loads. They say you can set them in css if you want but if so do both.

After some testing it does give a visual load time benifit, and if it gives a 0.3% chance of being higher ranked, i need to do it.

every time is use the asp image it renders is with
<img id="MainContent_Image" src="image.png" alt="imagename" style="height:200px;width:50px;" />

but need it more like:
<img src="image.png" alt="imagename" width="200" height="50" />
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39174784
You may have to use img tags directly then.
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 2000 total points
ID: 39174787
Hmm.  The two syntaxes are functionally identical.  I would expect Google to accept either one.  Does Google explicitly state they prefer one over the other?
0
 
LVL 3

Author Comment

by:taz8020
ID: 39174804
Cannot see it on google, but they never say what they are looking for.
Time wise it is no different, but in a visual way it looks like its faster as the page does not go blank for as long. Just want to try it.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39175025
Can you make two versions of a page (or two separate pages) - one with ASP controls and one with HTML controls, but otherwise identical (or functionally identical).  That might tell you what you need to know.
0
 
LVL 3

Author Comment

by:taz8020
ID: 39175036
yes but have so many asp:image controls, is there a way to set the size on render? eg get the image size then set its size as it renders
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question