Solved

ASP.NET

Posted on 2008-06-13
4
148 Views
Last Modified: 2013-11-26
Anyone have a tool that I can use to set aspect ratios on images for uplaods?  I'm getting stretched vertical mimages.
0
Comment
Question by:lrbrister
[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
  • 2
  • 2
4 Comments
 
LVL 21

Expert Comment

by:naspinski
ID: 21780478
If you only specify a width, the height of an img will adjust properly.  You just have to make sure no height is declared.
0
 

Author Comment

by:lrbrister
ID: 21780587
naspinski

Is there a way to look at the image on submit and determine if it's a landscape or portrait and then set the width or height based on that?
0
 
LVL 21

Accepted Solution

by:
naspinski earned 500 total points
ID: 21780715
Never thought of that, but turns out it is pretty easy.  You just have to use the System.Drawing.Bitmap object:
//this just represent getting your image into a Bitmap        
Bitmap bmp = new Bitmap(Server.MapPath(".") + "\\images\\starrating.gif");
if(bmp.Height > bmp.Width)
  //Portrait
else
  //Landscape

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 31466980
I have a "Crop" question coming up.  But thanks for this answer.
0

Featured Post

Technology Partners: 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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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