Extract all images of your skin with a script to serve them by apache

Ecrit le 21 Jun 2010

Following the unloading Plone conference at budapest last year, you may want to serve images from skin directly by apache.

To do this you will need first to extract images. So here is a small python script to help you:

skintool = context.portal_skins
skin = skintool.getDefaultSkin()
PATHS = skintool.getSkinPath(skin).split(',')

images = skintool.ZopeFind(skintool, obj_metatypes=['Filesystem Image'],search_sub=1)
images_skin = [path for path, obj in images if path.split('/')[0] in PATHS and skintool.isFirstInSkin(path)]

images_str = "\n".join(['/'.join(path.split('/')[1:]) for path,obj in images])
print "You have extracted %s images. Here is the result:"%(len(images_skin))
print images_str
return printed

To use it, you just have to go in the Zope Management Interface (ZMI), Add a Script (Python) with the drop down menu and paste this script. Next you can excecute it with the “test” tab or access it by it’s url.

Write the content of the result page in a text file and then follow this blog post: http://www.makina-corpus.org/blog/use-rewritemap-prevent-proxying-some-static-contents

Hope this will help you to unloading Plone.