Introduce thumb_mime_size to vfs-mime widget in order to specify thumb size for specific mime types

This commit is contained in:
Hadi Nategh 2015-01-21 15:03:59 +00:00
parent 0f8d251fc4
commit 847bc2ef15

View File

@ -270,11 +270,18 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM],
type: "boolean",
default: true,
description: "Clicking on an image would popup an expose view"
},
thumb_mime_size:{
name: "Image thumbnail size",
type: "string",
default:"",
description:" Size of thumbnail in pixel for specified mime type with syntax of: mime_type(s),size (eg. image,video,128)"
}
},
legacyOptions:["size"],
/**
* Constructor
*
@ -359,6 +366,16 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM],
{
src += "&thsize="+this.options.size;
}
else if (this.options.thumb_mime_size)
{
var mime_size = this.options.thumb_mime_size.split(',');
var mime_regex = RegExp(_value.mime.split('/')[0]);
if (typeof mime_size != 'undefined' && jQuery.isArray(mime_size)
&& !isNaN(mime_size[mime_size.length-1]) && isNaN(mime_size[0]) && this.options.thumb_mime_size.match(mime_regex[0], 'ig'))
{
src += "&thsize=" + mime_size[mime_size.length-1];
}
}
this.image.css("max-width", "100%");
}
this.image.attr("src", src);