c# - Load external images efficiency -
i know efficient way load external images website.
for example: website's url "www.mydomain.com". external image http://www.myimagedomain.com/image.jpg
. common way write simple html image-tag <img src="http://www.myimagedomain.com/image.jpg" />
.
the problem is, if requested image large (8000x6000 pixel) want show picture thumbnail/preview 200x200 pixel, e.g on mobile devices.
based on information wrote little ashx (c#) handler downloads requested image , resizes given weight/height parameters, this:
<img src="http://www.mydomain.com/img.ashx?imageurl=http://www.myimagedomain.com/image.jpg&w=200&h=200" />
now there problem, because httphandler downloads requested image, on-the-fly.
my new approach generate based64 string resized image , save in database once?! recommend or there way eliminated download problem? maybe know how google-image-search prevents problem?
i don't want save external images on own server...
i suggest use image resizer library, solves of need in efficient way - caching included: http://www.nuget.org/packages/imageresizer/
i think google caches image thumbnails on servers search.
Comments
Post a Comment