Skip to content

Instantly share code, notes, and snippets.

@x404
Forked from vidhav/collections.imageplus.js
Created November 29, 2017 09:28
Show Gist options
  • Save x404/6fd454957f0ef34c8a9e13e989d77589 to your computer and use it in GitHub Desktop.
Save x404/6fd454957f0ef34c8a9e13e989d77589 to your computer and use it in GitHub Desktop.
Custom MODX Collections renderer for Image+
Collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) {
if (value != '' && value != null) {
var data = Ext.decode(value);
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1';
var params = {};
params.src = MODx.config['collections.renderer_image_path'] + data.sourceImg.src;
params.w = 100;
if (data.sourceImg.src.indexOf('.png') !== -1) {
params.f = 'png';
}
for (var i in params) {
url += '&' + i + '=' + params[i];
}
return '<img alt="" src="' + url + '" width="' + (params.w || 80) + '">';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment