1
votes

I have more than 500 images in Sitecore Media Library each image size is more than 1MB. Currently we are displaying these images as thumbnails in webpage but it takes more time to load.

So I planned reduce the size to less than 50KB for thumbnails and which click the image it shows the original size image. So how can I programmatically clone all the 500 images and compress the size in Sitecore?

1
Do I understand correctly that you now display the 1MB image as thumbnail without letting Sitecore resize it for you? (by using parameters in the request)Gatogordo
Why don't you use the in-built functionality in Sitecore to resize the images for thumbnails so they are smaller? sitecore.net/learn/blogs/technical-blogs/…jammykam
yes i am showing all thumbnails of images with 100px width*height using cssESWARAN M
@jammykam : using this solution it may affect performance because when request image it convert image size in server side right.ESWARAN M
It will only do this once, the first time an thumbnail is requested and then it will cache it to disk. The next time it will stream the already cached image rather than resizing again.jammykam

1 Answers

2
votes

Sitecore has builded solution for resize image due to the size of image will be smaller. You can use query string parameters to get smaller image, then sitecore will resize and cached image so it will do this only once. More information: http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2011/05/media-options-and-query-string-parameters-in-the-sitecore-aspnet-cms.aspx

You can always reduce size of image by image compression. If you save media files on disk you can iterate by anyone and use this tool: https://tinyjpg.com/.

If you saved media files in DB you can just get item by xpath how to: http://www.symsoftsolutions.com/Blog/List/Get-Media-Url-From-Sitecore, compress like above and save new item.