Last active
April 12, 2024 11:43
-
-
Save vidhav/e502e7761641c3cb812c to your computer and use it in GitHub Desktop.
Custom MODX Collections renderer for Image+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Here is the renderer with cropping :) Thanks!
https://gist.github.com/jenswittmann/e26ee4a3740cc7acf865e041a7af66f5