Clone sitecore Media Library image folder

♀尐吖头ヾ 提交于 2019-12-11 12:59:31

问题


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:


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.



来源:https://stackoverflow.com/questions/37160764/clone-sitecore-media-library-image-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!