return content
sio = StringIO.StringIO(content)
- image = Image.open(sio)
+ try:
+ image = Image.open(sio)
+
+ except Exception as e:
+ logging.error('failed to open media preview image file: %s' % e)
+ return None
+
width = width and int(width) or image.size[0]
height = height and int(height) or image.size[1]
function addEntries() {
/* add the entries to the media list */
- entries.forEach(function (entry, i) {
+ entries.forEach(function (entry) {
var entryDiv = entry.div;
var detailsDiv = null;
deleteButton.click(function () {
doDeleteFile(basePath + mediaType + '/' + cameraId + '/delete' + entry.path, function () {
entryDiv.remove();
- entries.splice(i, 1); /* remove entry from group */
+ var pos = entries.indexOf(entry);
+ if (pos >= 0) {
+ entries.splice(pos, 1); /* remove entry from group */
+ }
/* update text on group button */
groupsDiv.find('div.media-dialog-group-button').each(function () {