Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- foreach (['upload_files','upload_images'] as $option){
- if($setting = $modx->getObject('modSystemSetting',['key'=>$option])){
- $extensions = explode(',',$setting->get('value'));
- if(!in_array('webp',$extensions)){
- $extensions[] = 'webp';
- $setting->set('value',implode(',',$extensions));
- $setting->save();
- }
- }
- }
- $ms2images = 2;
- $source = $modx->getObject('modMediaSource',$ms2images);
- $props = $source->get('properties');
- $props['thumbnailType']['options'][] = ['text'=>'webp','value'=>'webp'];
- $props['imageExtensions']['value'] .= ',webp';
- $props['allowedFileTypes']['value'] .= ',webp';
- $source->set('properties',$props);
- $source->save();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement