Link to home
Start Free TrialLog in
Avatar of spikehalliwell
spikehalliwell

asked on

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
Avatar of sybe
sybe

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.
Avatar of spikehalliwell

ASKER

HUGE files not thumbnailed would cause a lot of bandwidth and slow user access to my pages by a lot
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.
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
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
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..
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
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
these are all helpful but don't really solve my origional question - how do i resize an image not hosted on my local domain??
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)
i don't want to go down this route until i'm sure it will work
I see. So you are suggesting perhaps that I should test all of this and get back to you?

FtB
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
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
is that action possible in asp.net?
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much i'll take this issue as resolved - fritz_the_blank thank you again

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

FtB