Is it safe to delete default image/file styles? For consistency and usability purposes, we want to set up a default set of image styles which are clearly understood by our editors. This probably means getting rid of default style names like "medium", "large" etc.

The question is, is this likely to break other third party/contrib code that relies on the Styles module? Might we need to patch these (possibly too much of a headache) or just configure them to use the new styles?

Note: styles seem to be defined and displayed to editors purely by their (sometimes auto-capitalised) machine names, so we can't set a friendly name that differs from this.

Also: Is it even possible to remove existing styles? I can only seem to find ways/hooks to add them.
You shouldn't remove the default styles (as mentionned), but you can alter them using hook_image_styles_alter

You can remove the options from selected forms using hook_form_alter (as mentionned).

I tried to find a generic approach and happily found this page.

This is how I applied the info:

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  recursiveRemoval($form, 'thumbnail');
  recursiveRemoval($form, 'medium');
  recursiveRemoval($form, 'large');
  recursiveRemoval($form, 'square_thumbnail');

}

function recursiveRemoval(&amp;$array, $val) {

  if (is_array($array)) {

    foreach($array as $key =&gt; &amp;$arrayElement) {

      if(is_array($arrayElement)) {

        recursiveRemoval($arrayElement, $val);

      } else {

        if($arrayElement === $val) {

          unset($array[$key]);

        }

      }
    }
  }

}


N.B.: Use at your own discretion.