ManicCW
Well-known member
Hi i use this code to dynamicly create thumb on web site:
page: Thumb.aspx
And then i call that page as imageurl of the Image control like:
page: Gallery.aspx
but this is slow! is there another way except making thumb on image upload or using getthumbnail method?
page: Thumb.aspx
VB.NET:
[SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Page_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load
CropImage(Request.QueryString("ImageName"), "Middle")
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] CropImage([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] ImageName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] Anchor [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=black][/COLOR][/SIZE]
[SIZE=2][COLOR=black]-- here is code for copping image --[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000][/COLOR][/SIZE][SIZE=2][/SIZE]
[SIZE=2]bmPhoto.Save(Response.OutputStream)[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]bmPhoto.Dispose()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function
[/COLOR][/SIZE]
And then i call that page as imageurl of the Image control like:
page: Gallery.aspx
VB.NET:
[SIZE=2]
imgThumb.ImageUrl = "ImageGallery/Thumb.aspx?ImageName=" & e.Item.DataItem("Thumbnail").ToString
[/SIZE]
but this is slow! is there another way except making thumb on image upload or using getthumbnail method?