Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2004, 03:01 PM
Authorized User
 
Join Date: Jun 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Images question

 I have two imaging questions; they are both regarding a vb.net web form I am creating.

1) I have a hyperlink that I am assigning an Image to; the original image is 1024x768 I want to resize the image the hyperlink shows to 170x200. The height and width properties are not having any effect.

2) Is there a way to stop the original image from being downloaded? I know the image I put on the web form must be loaded to the client (170x200) I wish to not allow them to download the 1024x768 image.


 
Old October 10th, 2004, 03:47 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Please don;t cross-post. Your message will be read anyway. During the weekend it just takes a little longer before people read your post. Cross-posting is a waste of bandwidth, resources, time and makes this forum harder to use.

That said, there are a couple of problems with your approach.

First of all, you didn't post any code so it's hard to say why your height and width properties don't work.

Secondly, are you aware that the new dimensions of the image will cause the image to be distorted? 1024x768 has a different height/width proportion than 170 x 200, causing the image to appear stretched.

Thirdly, why do you want the browser to resize the image? The full image still needs to be downloaded, causing a waste of over 95 percent.
IMO, it's much better to resize the image at the server, and then send the scaled down version of it to the browser. You can use any graphics program to do this. Alternatively, with the classes in the System.Drawing namespace you can do this automatically as well.

That also answers your final question: don't put the large image on the web. Whatever you put on-line can be downloaded. In fact, once your users see the image in their browser, the image has already been downloaded and saved in the browser's cache.
By offering only the small image, you can kill two birds with one stone: your image displays correctly, you save a lot of bandwidth and you prevent your users from saving the large image (actually, that is three birds ;) )

If you post some code, we can try to find out why the height and width attributes don't work.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
IMAGES chmosiii CSS Cascading Style Sheets 6 November 8th, 2005 10:09 AM
Images question Warbird ADO.NET 1 October 9th, 2004 06:06 PM
Images TomAsp Access ASP 2 September 11th, 2004 07:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.