I want to crop an image at the server side (I am using ‘JCrop’ and ‘ASP.NET 3.5’).
There is a case when the user can add an image from external site to an article.I want
to anable the user to create a thumbnail from that image and store the result on the server.
In this case code like
string originalFile = Server.MapPath(this.srcImage.ImageUrl);
using (Image img = Image.FromFile(originalFile))
{
using (System.Drawing.Bitmap _bitmap = new System.Drawing.Bitmap(w, h))
{
_bitmap.SetResolution(img.HorizontalResolution, img.VerticalResolution);
......
[Please see code here][1] will not work as the image URL is external and not a file on the server's file system.
Can someone please show me how can I create an System.Drawing.Image object from a given external image URL string
Load the image from web, put the data in a MemoryStream (see here for an example: http://www.vcskicks.com/image-from-url.php)
and then use FromStream() method:
http://msdn.microsoft.com/it-it/library/93z9ee4x(v=VS.80).aspx