Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Image Centering Problem (http://www.velocityreviews.com/forums/t774237-image-centering-problem.html)

Murdoc 09-13-2004 07:48 AM

Image Centering Problem
 
Hi all,

I am currently using the server-side Image control to display images, with the image paths being
stored in an SQL database. Everything is working fine, but I have run into a small problem with the
image sizes. Currently, some images are smaller than others, and when they are displayed in the
control, they are stretched, and hence distorted.

Is there any way I can automatically centre the image without changing the size of the control? The
only other options I would have then, would be either modifying the size of the control for each
image, or resizing all the images.

--
Murdoc
; =================================
"Insanity in individuals is something rare - but in groups, parties, nations and epochs, it is the
rule."
-- Friedrich Nietzsche

"All Congresses and Parliaments have a kindly feeling for idiots, and a compassion for them, on
account of personal experience and heredity."
-- Mark Twain

"A single death is a tragedy, a million deaths is a statistic."
-- Joseph Stalin

Ken Cox [Microsoft MVP] 09-14-2004 12:38 AM

Re: Image Centering Problem
 
How about putting a single-cell table with a fixed sized and no borders
around the image control. Centre the contents of the cell with the align
attribute.

Then, don't set any image size for the image control so that it sizes itself
according to the image it gets. That way, the all of the images would take
up the same space but the smaller ones would appear in the centre.

Would that work?

Ken

"Murdoc" <murdoc_0@hotmail.com> wrote in message
news:xn0dn83iym1u99001@msnews.microsoft.com...
> Hi all,
>
> I am currently using the server-side Image control to display images, with
> the image paths being
> stored in an SQL database. Everything is working fine, but I have run into
> a small problem with the
> image sizes. Currently, some images are smaller than others, and when they
> are displayed in the
> control, they are stretched, and hence distorted.
>
> Is there any way I can automatically centre the image without changing the
> size of the control? The
> only other options I would have then, would be either modifying the size
> of the control for each
> image, or resizing all the images.
>
> --
> Murdoc
> ; =================================
> "Insanity in individuals is something rare - but in groups, parties,
> nations and epochs, it is the
> rule."
> -- Friedrich Nietzsche
>
> "All Congresses and Parliaments have a kindly feeling for idiots, and a
> compassion for them, on
> account of personal experience and heredity."
> -- Mark Twain
>
> "A single death is a tragedy, a million deaths is a statistic."
> -- Joseph Stalin



Murdoc 09-14-2004 05:34 AM

Re: Image Centering Problem
 
Ken Cox [Microsoft MVP] wrote:

> How about putting a single-cell table with a fixed sized and no borders around the image control.
> Centre the contents of the cell with the align attribute.
>
> Then, don't set any image size for the image control so that it sizes itself according to the
> image it gets. That way, the all of the images would take up the same space but the smaller ones
> would appear in the centre.
>
> Would that work?


Yeah, it will. Thanks. I didn't think it would be that simple.

--
Murdoc
; =================================
"Insanity in individuals is something rare - but in groups, parties, nations and epochs, it is the
rule."
-- Friedrich Nietzsche

"All Congresses and Parliaments have a kindly feeling for idiots, and a compassion for them, on
account of personal experience and heredity."
-- Mark Twain

"A single death is a tragedy, a million deaths is a statistic."
-- Joseph Stalin


All times are GMT. The time now is 08:28 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.