473,788 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want an image in a tablecell to be scaled to fit the cell without distorting the image

I want an image in a tablecell to be scaled to fit the cell without
distorting the image.

I don't know what the image aspect ratio will be.

Sometimes I'd expect to see the width fit the cell and the height be smaller
than the cell.

Sometimes I'd expect to see the height fit the cell and the width be smaller
than the cell.

I tried 100% for both width and height but that makes both fit with
distortion.

Is there any way to do this?

Thanks
Jun 26 '07 #1
4 1630
You can manipulate on images only on server side. Table resizing takes place
on client side. You can't really combine these two things well. Better find
a compromise.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I want an image in a tablecell to be scaled to fit the cell without
distorting the image.

I don't know what the image aspect ratio will be.

Sometimes I'd expect to see the width fit the cell and the height be
smaller than the cell.

Sometimes I'd expect to see the height fit the cell and the width be
smaller than the cell.

I tried 100% for both width and height but that makes both fit with
distortion.

Is there any way to do this?

Thanks


Jun 26 '07 #2

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:OE******** ******@TK2MSFTN GP02.phx.gbl...
You can manipulate on images only on server side.
Does this mean using code such as VB?
If so, can you point me to a place where I can see some code?
>Table resizing takes place on client side. You can't really combine these
two things well. Better find a compromise.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>I want an image in a tablecell to be scaled to fit the cell without
distorting the image.

I don't know what the image aspect ratio will be.

Sometimes I'd expect to see the width fit the cell and the height be
smaller than the cell.

Sometimes I'd expect to see the height fit the cell and the width be
smaller than the cell.

I tried 100% for both width and height but that makes both fit with
distortion.

Is there any way to do this?

Thanks



Jun 26 '07 #3
You need to use GDI+ with System.Drawing namespace. It may not be as simple
as you would like.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:uI******** ********@TK2MSF TNGP03.phx.gbl. ..
>
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:OE******** ******@TK2MSFTN GP02.phx.gbl...
>You can manipulate on images only on server side.

Does this mean using code such as VB?
If so, can you point me to a place where I can see some code?
>>Table resizing takes place on client side. You can't really combine these
two things well. Better find a compromise.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>>>I want an image in a tablecell to be scaled to fit the cell without
distorting the image.

I don't know what the image aspect ratio will be.

Sometimes I'd expect to see the width fit the cell and the height be
smaller than the cell.

Sometimes I'd expect to see the height fit the cell and the width be
smaller than the cell.

I tried 100% for both width and height but that makes both fit with
distortion.

Is there any way to do this?

Thanks




Jun 26 '07 #4
I would know how to do it if I were writing a Window app but have no idea
how to interface such code with this app.

Does this NG include topics relating to using System.Drawing for web design?
thanks

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:eV******** ******@TK2MSFTN GP03.phx.gbl...
You need to use GDI+ with System.Drawing namespace. It may not be as
simple as you would like.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:uI******** ********@TK2MSF TNGP03.phx.gbl. ..
>>
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:OE******** ******@TK2MSFTN GP02.phx.gbl...
>>You can manipulate on images only on server side.

Does this mean using code such as VB?
If so, can you point me to a place where I can see some code?
>>>Table resizing takes place on client side. You can't really combine these
two things well. Better find a compromise.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
" active" <ac********** @a-znet.comwrote in message
news:%2****** **********@TK2M SFTNGP03.phx.gb l...
I want an image in a tablecell to be scaled to fit the cell without
distortin g the image.

I don't know what the image aspect ratio will be.

Sometimes I'd expect to see the width fit the cell and the height be
smaller than the cell.

Sometimes I'd expect to see the height fit the cell and the width be
smaller than the cell.

I tried 100% for both width and height but that makes both fit with
distortion .

Is there any way to do this?

Thanks




Jun 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2077
by: John | last post by:
I am rotating images of different dimensions. My problem is that when a new image is displayed in a new position which had an image of a different dimension, the old image is first stretched to the dimension of the new image, before the new image is loaded. How can I stop this stretching behavior? See the banner images on the right at http://finialworld.com thank you John
7
18926
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t = document.createElement("TABLE"); t.style.position = "absolute"; t.style.left = "100px"; t.style.top = "100px"; t.style.width = "200px";
4
5405
by: Serdar Kalaycý | last post by:
I create a TableCell by TableCell cell = new TableCell() but I could not find how to add a TextBox inside this cell. Any ideas? Thanks in advance Serdar KALAYCI --
2
9313
by: Manny Chohan | last post by:
HI Guys, I need to load image in table cell from codebehind. i have the following code: TableRow tRow = new TableRow(); Table2.Rows.Add(tRow); TableCell tCell1= new TableCell(); if (property.Value.ToString()=="1") { tCell1.Image="test";
2
12233
by: Manny Chohan | last post by:
i am trying to add image to table cell. Here is my code.. System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); img.ImageUrl="http://localhost/Lhw/Images/i.p.new.gif"; for(int i=0; i < allRecords.Length; i++) { TableRow tRow = new TableRow(); Table2.Rows.Add(tRow); TableCell tCell1= new TableCell(); tCell1.Controls.Add(img);
3
8801
by: Shawn | last post by:
Hi. I have an asp:table, like this: <asp:Table runat="server" id="Table1"> <asp:TableRow Runat="server"> <asp:TableCell id="tc1" Runat="server">&nbsp;</asp:TableCell> <asp:TableCell id="tc2" Runat="server">&nbsp;</asp:TableCell> </asp:TableRow> </asp:Table>
2
2646
by: Amelyan | last post by:
If I have spaces in my Text property of Label, and I add it to TableCell, it wraps at spaces. E.g. Label lb = new Label(); lb.Text = "Hello, World!" TableCell cell = new TableCell(); cell.Controls.Add(lb); The resulting TableCell html render will look like this
1
2637
by: mhoeneveld | last post by:
I am writing a small script to fade the opacity of an image/object. The script itself works fine only I do have some unwanted behaviour. I do use a tablecell object and the mouseover/mouseout to activate the script. In the same cell are some links listed and when you move the cursor over the links the image starts to flicker. This is because of the getElementById that identifies each link as an object. Anyone knows how I can solve...
4
9755
by: frankentux | last post by:
Hi there, I'm losing hair trying to figure out how I can actually get the text out of an existing .ods file. Currently I have: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import TableRow,TableCell from odf import text doc = load("/tmp/match_data.ods")
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.