+ else:
+ thumb = image
+ html.write(' <td><a href="%s"><img src="%s"/></a></td>\n' % (image, thumb))
+
+
+def is_image(path):
+ return \
+ path.endswith('.png') \
+ and not path.endswith('.diff.png') \
+ and not path.endswith('.thumb.png')
+
+
+def find_images(prefix):
+ prefix = os.path.abspath(prefix)
+ if os.path.isdir(prefix):
+ prefix_dir = prefix
+ else:
+ prefix_dir = os.path.dirname(prefix)
+
+ images = []
+ for dirname, dirnames, filenames in os.walk(prefix_dir, followlinks=True):
+ for filename in filenames:
+ filepath = os.path.join(dirname, filename)
+ if filepath.startswith(prefix) and is_image(filepath):
+ images.append(filepath[len(prefix):])
+
+ return images