Solved

ASP.net resize image from external domain

Posted on 2003-11-09
20
481 Views
Last Modified: 2012-06-27
Hi, i'm looking for a way to code a page in ASP.NET so that you can stick an image location in the querystring, for example

"blah.asx?image=http://www.google.com/images/logo.gif" and page will become the image - but resize it first if that makes sense

so if i created an image on a webpage, using the basic img tag, <img src="blah.asx?image=http://www.google.com/images/logo.gif"> It would show the image in the querystring, but resize the image on the fly, to a max proportion i set within the asx file keeping the aspect ratios). Can anyone point me in the right direction for doing this, or find me the code to do this

Thanks very much

SP!KE
0
Comment
Question by:spikehalliwell
  • 9
  • 8
  • 3
20 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 9710114
Why not simply:

<img src="blah.asx?image=http://www.google.com/images/logo.gif" width="30" height="30">

then the browser will do the resizing, save you a lot of work.
0
 

Author Comment

by:spikehalliwell
ID: 9710122
HUGE files not thumbnailed would cause a lot of bandwidth and slow user access to my pages by a lot
0
 
LVL 28

Expert Comment

by:sybe
ID: 9710127
i don't know about dotnet, but plain asp can't resize images on the fly, you need a component for that. There are some available, but the good ones will cost you some money.
0
 

Author Comment

by:spikehalliwell
ID: 9710147
i believe ASP.NET can handle images without componants - it can certainly thumbnail images - i'm just not sure of the code which is why i'm asking on here
0
 

Author Comment

by:spikehalliwell
ID: 9710151
i'm fairly sure ASP.net can cope with image resizing - its one of the new features - it can certainly create thumbnails on the fly -though i think they might be from local files - i'm just not sure of the code- which is why i'm posting on here
0
 
LVL 28

Expert Comment

by:sybe
ID: 9710167
Have you thought about copyright issues? You probably can't "steal" an image from another website and process it and offer it to your customers..
0
 

Author Comment

by:spikehalliwell
ID: 9710175
google was an example - its a function on one of my sites to add a URL with their profile image on it - which means they must own the copyright of their image - and there is a disclaimer to that effect - so its not stealing
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710235
Perhaps this:

http://www.eggheadcafe.com/articles/20030515.asp

You will just have to replace the path from something local to your remote path.


FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710238
BTW, please be sure to finalize your question at:

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20732287.html

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710247
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:spikehalliwell
ID: 9710268
these are all helpful but don't really solve my origional question - how do i resize an image not hosted on my local domain??
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710295
It seems to me that a place to start would be to try passing the external url as a parameter for the physical path to this method.....

public void GenerateThumbNail(string sPhysicalPath,string sOrgFileName,string sThumbNailFileName,ImageFormat oFormat)
0
 

Author Comment

by:spikehalliwell
ID: 9710313
i don't want to go down this route until i'm sure it will work
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710316
I see. So you are suggesting perhaps that I should test all of this and get back to you?

FtB
0
 

Author Comment

by:spikehalliwell
ID: 9710332
no that would be much to much work - it would just be easier if someone could say - yes you can definatly thumbnail images that aren't located on your domain
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9710347
I am guessing that you will have to get the image from the remote site, download it to a local drive on your server, and then produce the thumbnail


FtB
0
 

Author Comment

by:spikehalliwell
ID: 9710367
is that action possible in asp.net?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 250 total points
ID: 9724046
Sorry not to have responded...

There should be a way to do that. For example, in ASP, I can do this:

Function GetHTML(strURL)
      Dim objXMLHTTP, strReturn
      Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
      objXMLHTTP.Open "GET", strURL, False"
      objXMLHTTP.Send
      strReturn = objXMLHTTP.responseText
      Set objXMLHTTP = Nothing
      GetHTML = strReturn
End Function

to grab the contents of a page. So I am guessing that ASP.Net might have that sort of functionality, but I don't know how to do it...

FtB
0
 

Author Comment

by:spikehalliwell
ID: 9724764
Thank you very much i'll take this issue as resolved - fritz_the_blank thank you again

SP!KE
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9726382
I am sorry, but I don't think that I helped very much here...

FtB
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now