Hello Mark, any news about this?
While it’s crucial for us, we use phpThumbOf to rescale images, but for large galleries this severely clogs server AFTER upload (as mentioned here MoreGallery import serious webserver performace issue - #8 by hrabovec).
So I tried to write MoreGallery_OnImageCreate plugin that uses phpThumbOf on each image upload but have failed. The idea was to use exactly same resize options as we use on front-end, so files are already in phpthumof cache when requested. With this approach there is no need to regenerate old galleries, but new ones are created in better way.
This is supposed to work, but crashing entire upload:
if ($modx->event->name !== 'MoreGallery_OnImageCreate') return;
$pt_settings = array();
$pt_options = array();
$modx->loadClass('phpThumbOf', MODX_CORE_PATH . 'components/phpthumbof/model/', true, true);
$pThumb = new phpThumbOf($modx, $pt_settings, $pt_options);
$file_path = $object->getFilePath();
$options = 'w=1500&h=1000&zc=0&far=0&f=jpg&q=80';
$result = $pThumb->createThumbnail($file_path, $options);
After long debugging it seems that Resizer somehow conflict with MoreGallery, probably loading Imagine libraries on its own.
Adding $pt_options['useResizer'] = false; to disable Resizer works as intended, but generates different cache filename (useResizer is used in cache hashing), so doesn’t really help.
Any ideas?