Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

ASP.net resize image from external domain

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
spikehalliwell
Asked:
spikehalliwell
  • 9
  • 8
  • 3
1 Solution
 
sybeCommented:
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
 
spikehalliwellAuthor Commented:
HUGE files not thumbnailed would cause a lot of bandwidth and slow user access to my pages by a lot
0
 
sybeCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
spikehalliwellAuthor Commented:
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
 
spikehalliwellAuthor Commented:
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
 
sybeCommented:
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
 
spikehalliwellAuthor Commented:
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
 
fritz_the_blankCommented:
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
 
fritz_the_blankCommented:
BTW, please be sure to finalize your question at:

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

FtB
0
 
fritz_the_blankCommented:
0
 
spikehalliwellAuthor Commented:
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
 
fritz_the_blankCommented:
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
 
spikehalliwellAuthor Commented:
i don't want to go down this route until i'm sure it will work
0
 
fritz_the_blankCommented:
I see. So you are suggesting perhaps that I should test all of this and get back to you?

FtB
0
 
spikehalliwellAuthor Commented:
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
 
fritz_the_blankCommented:
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
 
spikehalliwellAuthor Commented:
is that action possible in asp.net?
0
 
fritz_the_blankCommented:
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
 
spikehalliwellAuthor Commented:
Thank you very much i'll take this issue as resolved - fritz_the_blank thank you again

SP!KE
0
 
fritz_the_blankCommented:
I am sorry, but I don't think that I helped very much here...

FtB
0

Featured Post

Industry Leaders: 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!

  • 9
  • 8
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now